public void switchMove() { if (!isGameOver()) { if (playerMoved) { playerMoved = false; if (monsterExist("Terrex") && !monsterFreezed()) { mAI = monster.GetComponent <MonsterAI>(); mAI.attack(); } if (!playerFreezed(cpu)) { enemyAI.enemyAI(); } cpuMoved = true; cpu.setIsFreezed(false); if (ms != null && ms.getIsFreezed()) { ms.setIsFreezed(false); } turn.switchMove(); } else if (cpuMoved) { cpuMoved = false; if (monsterExist("Goblin") && !monsterFreezed()) { mAI = monster.GetComponent <MonsterAI>(); mAI.attack(); } if (!playerFreezed(player)) { playerAI.playerAI(); } playerMoved = true; player.setIsFreezed(false); if (ms != null && ms.getIsFreezed()) { ms.setIsFreezed(false); } turn.switchMove(); } if (turn.getMove() % 2 == 1 && turn.getTurnChanged()) { enemyAI.setSkillInPath(); skillManagerPlayer.countdown(); skillManagerCpu.countdown(); turn.setTurnChanged(false); } } }
public bool attackMonster() { monsterGO = GameObject.FindGameObjectWithTag(monsterOpponent); if (monsterGO != null) { ms = monsterGO.GetComponent <MonsterStats>(); if (skillNumber == 7) { ms.setIsFreezed(true); } else { ms.loseHP(hp); } player.loseMP(mp); skills[skillNumber].setCooldown(); return(true); } return(false); }