void OnCollisionStay(Collision other) { if (other.gameObject.tag == "Player") { FirstSceneController.getInstance().setGameOver(-1); } }
void Start() { player = FirstSceneController.getInstance().player; minX = this.transform.position.x - 2.5f; minZ = this.transform.position.z - 2.5f; patroling = true; time = 3f; }
void FixedUpdate() { if (FirstSceneController.getInstance().gameOver != 0) { return; } float translationX = Input.GetAxis("Horizontal") * 6; float translationZ = Input.GetAxis("Vertical") * 6; translationX *= Time.deltaTime; translationZ *= Time.deltaTime; this.transform.Translate(translationX, 0, 0); this.transform.Translate(0, 0, translationZ); }
void FixedUpdate() { if (FirstSceneController.getInstance().gameOver != 0) { return; } if (patroling) { GoAhead(); } else { Follow(); } }
void OnGUI() { if (FirstSceneController.getInstance().gameOver == -1) { GUIStyle style = new GUIStyle(); style.normal.background = null; style.normal.textColor = new Color(0, 0, 0); style.fontSize = 40; GUI.TextField(new Rect(200, 150, 300, 50), "Player2 Wins!", style); } if (FirstSceneController.getInstance().gameOver == 1) { GUIStyle style = new GUIStyle(); style.normal.background = null; style.normal.textColor = new Color(0, 0, 0); style.fontSize = 40; GUI.TextField(new Rect(200, 150, 300, 50), "Player1 Wins!", style); } }
void Start() { firstSceneController = FirstSceneController.getInstance(); }
void CmdAddPlayer() { FirstSceneController.getInstance().addPlayer(); }