diff --git a/Assets/Scripts/Pet/PetAttack.cs b/Assets/Scripts/Pet/PetAttack.cs index 694b0cd11651f0c40bc9ecdf9f9348bcfcf7a6cb..9e1ab42c5960350a43d176bd591639d809df1998 100644 --- a/Assets/Scripts/Pet/PetAttack.cs +++ b/Assets/Scripts/Pet/PetAttack.cs @@ -9,14 +9,14 @@ public class PetAttack : MonoBehaviour public int timeBetweenAttack = 1; public float range = 3f; public float detectRadius = 3f; - + float timer; PetHealth petHealth; Animator anim; RaycastHit raycastHit; int shootableMask; - void Awake() + void Start() { anim = GetComponent<Animator>(); petHealth = GetComponent<PetHealth>(); diff --git a/Assets/Scripts/Pet/PetAttackerMovement.cs b/Assets/Scripts/Pet/PetAttackerMovement.cs index 45523f57d2f5a6c3839b02caaa33dec22622a327..39aa67a252ede415d2d6dc1b2c6458b261d9ef9b 100644 --- a/Assets/Scripts/Pet/PetAttackerMovement.cs +++ b/Assets/Scripts/Pet/PetAttackerMovement.cs @@ -11,12 +11,7 @@ public class PetAttackerMovement : PetMovement public float maxDistanceToEnemy = 2f; RaycastHit raycastHit; - int shootableMask; - - private void Start() - { - shootableMask = LayerMask.GetMask("Shootable"); - } + int shootableMask = LayerMask.GetMask("Shootable"); void Update() { diff --git a/Assets/Scripts/Pet/PetHealth.cs b/Assets/Scripts/Pet/PetHealth.cs index f1e32dedf4e42e0888e7c0b5bf44865da9c567b8..b6df33faf6592d34cc3c4661398e1363078f54e0 100644 --- a/Assets/Scripts/Pet/PetHealth.cs +++ b/Assets/Scripts/Pet/PetHealth.cs @@ -38,7 +38,7 @@ public class PetHealth : MonoBehaviour petAttack = GetComponent<PetAttack>(); petBuff = GetComponent<PetBuff>(); AudioClip hurtClip = petAudio.clip; - + currentHealth = startingHealth; // Show GameObject UI @@ -65,6 +65,7 @@ public class PetHealth : MonoBehaviour if (CheatMenu.killpet) { Death(); + CheatMenu.killpet = false; } } diff --git a/Assets/Scripts/Pet/PetMovement.cs b/Assets/Scripts/Pet/PetMovement.cs index cbfe09a833365f829821bd30a1bf7f609b80f98b..7d84a78c203ef91615e5a8e8adb0de97ed2a959b 100644 --- a/Assets/Scripts/Pet/PetMovement.cs +++ b/Assets/Scripts/Pet/PetMovement.cs @@ -10,8 +10,8 @@ public class PetMovement: MonoBehaviour Animator anim; public float rotationSpeed = 10f; - - void Awake() + + void Start() { GameObject player = GameObject.FindGameObjectWithTag("Player"); target = player.transform;