|
|
@ -7,7 +7,9 @@ public class Fireball : MonoBehaviour |
|
|
|
{ |
|
|
|
DragonMovement.AttackType _attackType = DragonMovement.AttackType.FIREBALL; |
|
|
|
float _lifeSpan = 0f; |
|
|
|
GameObject _follow = null; |
|
|
|
public DragonMovement.AttackType AttackType { get => _attackType; set => _attackType = value; } |
|
|
|
public GameObject Follow { get => _follow; set => _follow = value; } |
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start() |
|
|
@ -18,6 +20,11 @@ public class Fireball : MonoBehaviour |
|
|
|
// Update is called once per frame
|
|
|
|
void Update() |
|
|
|
{ |
|
|
|
if (_follow != null) |
|
|
|
{ |
|
|
|
this.transform.position = _follow.transform.position; |
|
|
|
} |
|
|
|
|
|
|
|
_lifeSpan += Time.deltaTime; |
|
|
|
float speed = 1000f; //fireball
|
|
|
|
if (_attackType == DragonMovement.AttackType.CONE) |
|
|
@ -34,7 +41,7 @@ public class Fireball : MonoBehaviour |
|
|
|
transform.position = new Vector3(transform.position.x + speed * Time.deltaTime, transform.position.y, transform.position.z); |
|
|
|
|
|
|
|
|
|
|
|
if (_lifeSpan >= 0.8f) |
|
|
|
if (_lifeSpan >= 1.8f) |
|
|
|
{ |
|
|
|
GameObject.Destroy(this.gameObject); |
|
|
|
} |
|
|
|