private void ReleaseRelicForAllPlayers() { for (int i = 0; i < minions.Length; i++) { PlayerRelicHandler h = minions [i].GetComponent <PlayerRelicHandler> (); if (h.HasRelic()) { h.ReleaseRelic(); break; } } }
// Update is called once per frame void Update() { anim.SetBool("isDashing", controller.IsDashing()); anim.SetBool("isJumping", controller.IsJumping()); anim.SetBool("isRunning", controller.IsRunning()); anim.SetFloat("Velocity", rb.velocity.magnitude); anim.SetBool("hasLanded", controller.IsGrounded()); anim.SetBool("isCarrying", prh.HasRelic()); // Debug.Log("isDashing : " + controller.IsDashing()); // Debug.Log("isJumping : " + controller.IsJumping()); // Debug.Log("isRunning : " + controller.IsRunning()); }
//Check for impacts with environment void OnCollisionEnter(Collision col) { //Make a new impact velocity, by subtracting own velocity speed Vector3 impact = col.relativeVelocity + lastVel; if (/*col.gameObject.tag == "Environment"*/ col.gameObject.layer == 13 && impact.magnitude >= impactResistance) { DeathSquished(); StartCoroutine(FlashImpactSparks()); //Remove energy from the relic (cap to 40) GameObject relic = GameObject.Find("Relic"); if (relic && playerRelicHandler.HasRelic()) { relic.GetComponent <RelicHealth> ().DrainEnergy(Mathf.Clamp(10f + impact.magnitude * 2, 0f, 30f)); } } }