diff --git a/unity/Assets/Prefabs/Bird.prefab b/unity/Assets/Prefabs/Bird.prefab index 9e18e92..074e4e7 100644 --- a/unity/Assets/Prefabs/Bird.prefab +++ b/unity/Assets/Prefabs/Bird.prefab @@ -28,7 +28,7 @@ Transform: m_GameObject: {fileID: 8800180563921210508} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 1137.7001, y: 597.95557, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: -1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 diff --git a/unity/Assets/Scripts/Bird.cs b/unity/Assets/Scripts/Bird.cs index 546907f..e2a5d79 100644 --- a/unity/Assets/Scripts/Bird.cs +++ b/unity/Assets/Scripts/Bird.cs @@ -4,7 +4,7 @@ using UnityEngine; public class Bird : MonoBehaviour { - const float horizontalSpeed = 200f; + const float horizontalSpeed = 100f; const float verticalSpeed = 5f; const float amplitude = 30f; diff --git a/unity/Assets/Scripts/Fireball.cs b/unity/Assets/Scripts/Fireball.cs index b5acc19..a282094 100644 --- a/unity/Assets/Scripts/Fireball.cs +++ b/unity/Assets/Scripts/Fireball.cs @@ -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); }