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