diff --git a/My project/Assets/Prefabs/Wizard.prefab b/My project/Assets/Prefabs/Wizard.prefab index d6a992a8f3e89fe45217aa61f5e2af7a1dfd894e..7e7bb9304c07708c98da3c6670e29e3360edde19 100644 --- a/My project/Assets/Prefabs/Wizard.prefab +++ b/My project/Assets/Prefabs/Wizard.prefab @@ -1793,7 +1793,7 @@ NavMeshAgent: m_Acceleration: 8 avoidancePriority: 50 m_AngularSpeed: 120 - m_StoppingDistance: 7 + m_StoppingDistance: 9 m_AutoTraverseOffMeshLink: 1 m_AutoBraking: 1 m_AutoRepath: 1 @@ -7928,6 +7928,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: eedd0e136b375a047bd0f49cbc28eace, type: 3} m_Name: m_EditorClassIdentifier: - damagePerShot: 30 + damagePerShot: 60 timeBetweenBullets: 0.15 range: 100 diff --git a/My project/Assets/Scripts/Pet/PetHealth.cs b/My project/Assets/Scripts/Pet/PetHealth.cs index d708fa83d0dfcd4460dcd056f40281fa201287f1..6639eab83d4061c214fefc58b07b99dbc76816ce 100644 --- a/My project/Assets/Scripts/Pet/PetHealth.cs +++ b/My project/Assets/Scripts/Pet/PetHealth.cs @@ -50,9 +50,12 @@ public class PetHealth : MonoBehaviour StartCoroutine(Death()); } } - StateController.petCurrentHealth = currentHealth; - petAudio.clip = hurtClip; - petAudio.Play(); + if(currentHealth > 0) + { + StateController.petCurrentHealth = currentHealth; + petAudio.clip = hurtClip; + petAudio.Play(); + } } public IEnumerator Death() diff --git a/My project/Assets/Scripts/Pet/PetManager.cs b/My project/Assets/Scripts/Pet/PetManager.cs index bc08b60c02462af9a2c8e4df4d11c54de85352ff..2a994037df66524f2605219aee7136d8b49c2391 100644 --- a/My project/Assets/Scripts/Pet/PetManager.cs +++ b/My project/Assets/Scripts/Pet/PetManager.cs @@ -27,10 +27,10 @@ public class PetManager : MonoBehaviour void Update() { - int spawnEnemy = 0; - if(Input.GetKeyDown(KeyCode.P) && !CheatController.isCheatEnabled){ - SpawnPet(spawnEnemy); - } + // int spawnEnemy = 0; + // if(Input.GetKeyDown(KeyCode.P) && !CheatController.isCheatEnabled){ + // SpawnPet(spawnEnemy); + // } } public void SpawnPet(int tag){ diff --git a/My project/Assets/Scripts/Pet/WizardController.cs b/My project/Assets/Scripts/Pet/WizardController.cs index e798904d792a4005dd6e86ff5e7def4cbbe38144..a4f54c95146b0c8858bc43c2a8567eb0d1c86b33 100644 --- a/My project/Assets/Scripts/Pet/WizardController.cs +++ b/My project/Assets/Scripts/Pet/WizardController.cs @@ -25,8 +25,8 @@ public class WizardController : MonoBehaviour void Update() { - colliderInSight = Physics.OverlapSphere(transform.position, 10, whatIsEnemy); - colliderInAttack = Physics.OverlapSphere(transform.position, 7, whatIsEnemy); + colliderInSight = Physics.OverlapSphere(transform.position, 12, whatIsEnemy); + colliderInAttack = Physics.OverlapSphere(transform.position, 9, whatIsEnemy); if(colliderInSight?.Length > 0) { @@ -59,12 +59,12 @@ public class WizardController : MonoBehaviour } transform.LookAt(enemy); - if(!alreadyAttacked) + if(!alreadyAttacked && enemy.GetComponent<EnemyHealth>().currentHealth > 0) { StartCoroutine(wizShooting.Shoot()); alreadyAttacked = true; - Invoke(nameof(ResetAttack), 1f); + Invoke(nameof(ResetAttack), 0.7f); } } @@ -75,8 +75,9 @@ public class WizardController : MonoBehaviour void ChaseEnemy(Transform enemy) { - nav.stoppingDistance = 7; - nav.SetDestination(colliderInSight[0].gameObject.transform.position); + if(enemy.GetComponent<EnemyHealth>().currentHealth <= 0) return; + nav.stoppingDistance = 9; + nav.SetDestination(enemy.position); if(nav.remainingDistance < nav.stoppingDistance) { anim.SetBool("isWalking", false); @@ -89,8 +90,8 @@ public class WizardController : MonoBehaviour void FollowPlayer() { - nav.stoppingDistance = 5; - if(Vector3.Distance(nav.transform.position, player.position) <= 5) + nav.stoppingDistance = 7; + if(Vector3.Distance(nav.transform.position, player.position) <= nav.stoppingDistance) { anim.SetBool("isWalking", false); return; diff --git a/My project/Assets/Scripts/Pet/WizardHealth.cs b/My project/Assets/Scripts/Pet/WizardHealth.cs index 71f4ff3fe4eb0d76b596a097f953945d21753c51..27779d137c010f4a58206104985892b429f07828 100644 --- a/My project/Assets/Scripts/Pet/WizardHealth.cs +++ b/My project/Assets/Scripts/Pet/WizardHealth.cs @@ -51,9 +51,12 @@ public class WizardHealth : MonoBehaviour StartCoroutine(Death()); } } - petAudio.clip = hurtClip; - petAudio.Play(); - StateController.petCurrentHealth = currentHealth; + if(currentHealth > 0) + { + StateController.petCurrentHealth = currentHealth; + petAudio.clip = hurtClip; + petAudio.Play(); + } } public IEnumerator Death()