private void OnTriggerEnter(Collider other) { RootMotionPlayerMovement ct = other.attachedRigidbody.gameObject.GetComponent <RootMotionPlayerMovement>(); if (ct != null) { getPotion.Play(); ct.GainSpeed(speedGain); boxCollider.enabled = false; Destroy(gameObject, 0.7f); } }
void Awake() { anim = GetComponent <Animator> (); rootMotionPlayerMovement = GetComponent <RootMotionPlayerMovement> (); playerShooting = GetComponentInChildren <PlayerShooting> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); currentHealth = maxHealth; playerAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); currentHealth = startingHealth; }