fixa the bullet spawning and make it Cool and Fun™️
This commit is contained in:
parent
f67ff54403
commit
c9f00f2f03
|
@ -26,7 +26,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1738226812227614583}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1726.4172, y: 488.75378, z: 274.96027}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
|
|
@ -234,7 +234,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 186457103}
|
||||
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
||||
m_LocalPosition: {x: 0, y: -2, z: 30}
|
||||
m_LocalPosition: {x: 0, y: -2, z: 100}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -274,9 +274,9 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pauseOnBeat: 16
|
||||
pauseLengthInBeats: 0
|
||||
beatOffset: 2
|
||||
spawnOnBeat: 1
|
||||
xMin: -5
|
||||
xMax: 5
|
||||
--- !u!114 &531937975 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class BeatSpawner : ShootInputBase
|
||||
{
|
||||
[SerializeField] private int pauseOnBeat;
|
||||
[SerializeField] private int pauseLengthInBeats;
|
||||
[SerializeField] private int beatOffset;
|
||||
[SerializeField] private int spawnOnBeat = 2;
|
||||
[SerializeField] private float xMin = -10;
|
||||
[SerializeField] private float xMax = 10;
|
||||
|
||||
private AudioBeatManager _audio;
|
||||
|
||||
private bool _shoot;
|
||||
private bool _isPaused = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -20,13 +20,9 @@ public class BeatSpawner : ShootInputBase
|
|||
|
||||
public void OnBeat(int beat)
|
||||
{
|
||||
if ((beat + beatOffset) % pauseOnBeat == 0)
|
||||
_isPaused = true;
|
||||
|
||||
if ((beat + beatOffset + pauseLengthInBeats) % pauseOnBeat == 0)
|
||||
_isPaused = false;
|
||||
|
||||
_shoot = !_isPaused;
|
||||
_shoot = beat % spawnOnBeat == 0;
|
||||
if (_shoot)
|
||||
transform.position = new Vector3(Random.Range(xMin, xMax), transform.position.y, transform.position.z);
|
||||
}
|
||||
|
||||
public override bool IsShooting()
|
||||
|
|
|
@ -5,14 +5,18 @@ using UnityEngine;
|
|||
[CreateAssetMenu]
|
||||
public class EnemyAppearBehaviour : BaseBulletBehaviour
|
||||
{
|
||||
[SerializeField] private float scaleUpDuration = 0.3f;
|
||||
[SerializeField] private float scaleUpDelay = 0.2f;
|
||||
[SerializeField] private float scaleUpOverBeats = 1;
|
||||
|
||||
private static AudioBeatManager _audio;
|
||||
|
||||
public override void DoBehaviour(Transform bullet, float size, Vector3 pos)
|
||||
{
|
||||
if (_audio == null)
|
||||
_audio = FindObjectOfType<AudioBeatManager>();
|
||||
|
||||
bullet.localScale = Vector3.zero;
|
||||
bullet.localPosition = pos;
|
||||
DOTween.Sequence()
|
||||
.Insert(scaleUpDelay, bullet.DOScale(Vector3.one * size, scaleUpDuration).SetEase(Ease.OutQuint));
|
||||
|
||||
bullet.DOScale(Vector3.one * size, _audio.TimeBetweenBeats * scaleUpOverBeats).SetEase(Ease.OutQuint);
|
||||
}
|
||||
}
|
|
@ -256,8 +256,8 @@ public class Weapon : ScriptableObject
|
|||
{
|
||||
var b = _bulletTransforms[i];
|
||||
if (b == null) continue;
|
||||
Gizmos.DrawSphere(b.position, b.localScale.x/2f * bulletSize.EvaluateMinMaxCurve());
|
||||
Gizmos.DrawSphere(_bullets[i].PrevPos, b.localScale.x/2f * bulletSize.EvaluateMinMaxCurve());
|
||||
Gizmos.DrawSphere(b.position, b.localScale.x/2f );
|
||||
Gizmos.DrawSphere(_bullets[i].PrevPos, b.localScale.x/2f );
|
||||
Gizmos.DrawLine(b.position, _bullets[i].PrevPos);
|
||||
|
||||
}
|
||||
|
|
|
@ -108,17 +108,17 @@ MonoBehaviour:
|
|||
zone:
|
||||
numToSpawn: 10
|
||||
offset: {x: 0, y: 0, z: 0}
|
||||
spawnType: 0
|
||||
spawnType: 2
|
||||
spawnDir: 0
|
||||
spawnPlane: 1
|
||||
width: 0
|
||||
height: 0
|
||||
surfaceOnly: 0
|
||||
surfaceOnly: 1
|
||||
evenDistribution: 0
|
||||
numSides: 5
|
||||
numPerSide: 10
|
||||
numSides: 3
|
||||
numPerSide: 5
|
||||
flipVertical: 0
|
||||
radius: 10
|
||||
radius: 5
|
||||
arc: 360
|
||||
composite: []
|
||||
manualFire: 1
|
||||
|
|
|
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 2bc932693ed0a470d9cf39b1c3168afb, type: 3}
|
||||
m_Name: PlayerWeapon
|
||||
m_EditorClassIdentifier:
|
||||
fireRate: 0.05
|
||||
fireRate: 0.025
|
||||
bulletSpeed:
|
||||
m_Mode: 0
|
||||
m_CurveMultiplier: 1
|
||||
|
@ -106,20 +106,20 @@ MonoBehaviour:
|
|||
m_Bits: 128
|
||||
accuracy: 2
|
||||
zone:
|
||||
numToSpawn: 1
|
||||
numToSpawn: 2
|
||||
offset: {x: 0, y: 0, z: 0}
|
||||
spawnType: 0
|
||||
spawnType: 1
|
||||
spawnDir: 0
|
||||
spawnPlane: 1
|
||||
width: 0
|
||||
width: 1.5
|
||||
height: 0
|
||||
surfaceOnly: 1
|
||||
evenDistribution: 1
|
||||
numSides: 3
|
||||
numSides: 2
|
||||
numPerSide: 5
|
||||
flipVertical: 1
|
||||
radius: 1.25
|
||||
arc: 360
|
||||
radius: 5.47
|
||||
arc: 82
|
||||
composite: []
|
||||
manualFire: 0
|
||||
behaviour: {fileID: 11400000, guid: 20de5bc0e86bc4037a85f6c46356a227, type: 2}
|
||||
|
|
Loading…
Reference in New Issue