diff --git a/Assets/Scenes/Gameplay.unity b/Assets/Scenes/Gameplay.unity index b9080fe..b8a9b17 100644 --- a/Assets/Scenes/Gameplay.unity +++ b/Assets/Scenes/Gameplay.unity @@ -362,7 +362,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 433189272} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 9.76, y: 0.18, z: 0} m_LocalScale: {x: 2.501405, y: 1.9675635, z: 1.0282} m_Children: [] @@ -563,7 +563,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 569685893} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.097918645, y: -0.20009108, z: -1} + m_LocalPosition: {x: -0.097918645, y: -0.20009108, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1027402150} diff --git a/Assets/Scripts/Fireball.cs b/Assets/Scripts/Fireball.cs index 6759913..4e1f0c3 100644 --- a/Assets/Scripts/Fireball.cs +++ b/Assets/Scripts/Fireball.cs @@ -6,7 +6,6 @@ public class Fireball : MonoBehaviour { public float speed = 1.0f; public AudioSource[] shootSounds; - public Vector3 destination; private int shootSoundVariations = 5; void Start() @@ -21,7 +20,6 @@ public class Fireball : MonoBehaviour void Move() { - float step = speed * Time.deltaTime; - transform.position = Vector3.MoveTowards(transform.position, destination, step); + transform.position += transform.up * speed * Time.deltaTime * -1; } } diff --git a/Assets/Scripts/FireballSpawner.cs b/Assets/Scripts/FireballSpawner.cs index 9d83691..f14f641 100644 --- a/Assets/Scripts/FireballSpawner.cs +++ b/Assets/Scripts/FireballSpawner.cs @@ -20,22 +20,18 @@ public class FireballSpawner : MonoBehaviour void Update() { - if (timeBetweenShots > 0) - { - timeBetweenShots -= Time.deltaTime; - } else - { - if (Input.GetMouseButtonDown(0)) ShootFireball(); - } + if (timeBetweenShots > 0) timeBetweenShots -= Time.deltaTime; + else if (Input.GetMouseButtonDown(0)) ShootFireball(); } void ShootFireball() { Vector3 mouseClickFromCamera = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseClickFromCamera.z = 0; + Vector3 angleToClick = dragonHead.transform.position - mouseClickFromCamera; GameObject spawnedFireball = Instantiate(fireball, fireballSource.transform.position, Quaternion.identity); - spawnedFireball.GetComponent().destination = mouseClickFromCamera; + spawnedFireball.transform.rotation = Quaternion.LookRotation(Vector3.forward, angleToClick); timeBetweenShots = originalTimeBetweenShots; }