// Start is called before the first frame update void Start() { pc = FindObjectOfType <PlayerCamera>(); p1p = FindObjectOfType <Player1P>(); pc.followPlayer = false; p1p.canMove = false; Invoke("TeleportApes", teleportTime); Invoke("BlackBarsLeave", introDuration); }
// This coroutine handles part of the Gorilla/Player collision interaction. // If the Gorilla hits the player, he should wait for a little bit before moving again. IEnumerator AttackPlayer(Player1P player) { Debug.Log("ATTACK PLAYER"); //-- ATTACK ANIMATION --// this.GetComponent <Animator>().Play("GorillaClap"); this.stunned = true; this.charging = false; // in case gorilla was charging this.canCharge = false; StopCoroutine("ChargeAttack"); // stop charging StopGorilla(); this.GetComponent <Rigidbody>().velocity = Vector3.zero; // remove forces on gorilla so he stops this.GetComponent <Rigidbody>().isKinematic = true; Debug.Log("Hit the Gorilla!"); // Subtract one from the health of the Player. if (!player.invulnerable) { player.health--; // Make the player temporarily invulnerable player.invulnerable = true; player.gorillaCollider = this.GetComponent <Collider>(); // Update the health of the player. player.StartCoroutine("updateHealth"); } yield return(new WaitForSeconds(0.75f)); // wait StartGorilla(); this.GetComponent <Animator>().Play("GorillaWalk1"); this.stunned = false; if (!this.canCharge) // if gorilla was in the middle of his charge { yield return(new WaitForSeconds(4f)); // reset charge cd this.canCharge = true; } }
void Start() { Time.timeScale = 1f; p1p = FindObjectOfType <Player1P>(); }