void attackGate() { if (Time.time > nextAttack) { transform.LookAt(gate.transform); attackAnimation.Play(); enemySounds.PlayOneShot(gateAttackSound, gateAttackVolume); gateController.takeDamage(attackDamage); if (gateController.health <= 0) { gate.transform.GetChild(numCheckpoints).gameObject.SetActive(false); } nextAttack = Time.time + attackPause; } transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y, 0); }