void Update() { Jump(); if (mask6.GetComponent <BoxCollider2D>().enabled == false && crate2ready) { crate2.GetComponent <Rigidbody2D>().gravityScale = 0.5f; crate2.GetComponent <BoxCollider2D>().enabled = true; crate2.transform.position = new Vector2(2.5f, 1.5f); crate2ready = false; } if (Input.GetKeyDown(KeyCode.P)) { SwordController sword = GetComponentInChildren <SwordController>(); sword.SendMessage("SwingSword"); swordsound.Play(); } if (Input.GetKeyDown(KeyCode.E)) { if (hat.transform.parent == this) { hat.SendMessage("Escape"); } } if (winner) { winTime += Time.deltaTime; } }
void Update() { Jump(); if (Input.GetKeyDown(KeyCode.P)) { SwordController sword = GetComponentInChildren <SwordController>(); sword.SendMessage("SwingSword"); swordsound.Play(); } if (Input.GetKeyDown(KeyCode.E)) { if (hat.transform.parent == this) { hat.SendMessage("Escape"); } } if (winner) { winTime += Time.deltaTime; } }