// Pipe animation IEnumerator Camera_Animation(Collider2D collision) { // Move away the player collision.transform.position = new Vector3(1000, 1000, 1000); // Tell listeners that player has entered a pipe Event_System.current.Pipe_Entered(); // Disable new animations Is_Pipe_Enabled = false; // Get state script from player Glucose_States state = collision.GetComponent <Glucose_States>(); // If the script exist if (state != null) { // Change the control of the player to pipe Debug.Log("Updated Glucose control to Pipe"); state.Change_Glucose_Controls(Glucose_States.Player_Control.Pipe); } // For all pipe sections for (int index = 0; index < Pipe_Section.Count; index++) { // Set the camer target to the current section Camera.Set_New_Target(Pipe_Section[index], Camera_Damping, false); // Then wait for half a second yield return(new WaitForSeconds(0.5f)); } // After that teleport the player to the last section and make the controls normal if (state != null) { state.Change_Glucose_Controls(Glucose_States.Player_Control.Normal); } // Freeze the player if (collision.GetComponent <Rigidbody2D>() != null) { collision.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); } // TP the player to tre last pipe collision.transform.position = Pipe_Section[Pipe_Section.Count - 1].transform.position; // Then reset camera target to the player Camera.Set_New_Target(collision.gameObject, 1, true); // Enable new aniamtions; Is_Pipe_Enabled = true; }
public void Be_Attacked() { if (Next_Attack < Time.time) { Current_Health--; Next_Attack = Time.time + Attack_Delay; if (Current_Health > 0) { Glucose_An.Launch_Stunt_Animation(); Glucose_Mo.Stunt(); Audio_Prefab_Sp.Play_A_Sound(1); } else { print("Health Dead"); Glucose_St.Change_Glucose_Controls(Glucose_States.Player_Control.Dead); } } HUD.Update_Glucose_Health_Bar(Current_Health, Max_Health); }