// Update is called once per frame void Update() { switch (currentState) { case (BattleStates.BEGIN): //currentState = (BattleStates)(((int)currentState + 1)%5); Player_turn = true; currentState = BattleStates.PLAYERCHOICE; Debug.Log("begin"); break; case (BattleStates.PLAYERCHOICE): Debug.Log("player"); break; case (BattleStates.ENEMYCHOICE): Player.TakeDamage(10); if (Player.getHp() <= 0) { currentState = BattleStates.DEFEAT; } else if (Enemy.getHp() <= 0) { currentState = BattleStates.VICTORY; } else { currentState = BattleStates.BEGIN; } Debug.Log("enemy"); break; case (BattleStates.DEFEAT): StateOfResult.text = "#99 VICTORYN'T ROYALE"; FinnishGame(); Debug.Log("defeat"); break; case (BattleStates.VICTORY): StateOfResult.text = "#1 VICTORY ROYALE"; FinnishGame(); Debug.Log("wictory"); break; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { blob.TakeDamage(1); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown("up") && !pause) { Enemy.takeDamage(20); } else if (Input.GetKeyDown("down") && !pause) { Player.TakeDamage(10); } else if (Input.GetKeyDown("escape")) { if (pause) { pause = false; } else { pause = true; } } }