public void Open(BattleShip playerChar, BattleShip enemyChar) { Window.SetActive(true); PlayerBlock.SetCharacter(playerChar); PlayerBlock.ToggleTargets(false); EnemyBlock.SetCharacter(enemyChar); PlayerChar = playerChar; AttackingChar = PlayerChar; AttackingCharBlock = PlayerBlock; EnemyChar = enemyChar; DefendingChar = EnemyChar; DefendingCharBlock = EnemyBlock; PlayerBlock.ToggleAttackIcons(isPlayerTurn); PlayerBlock.ToggleDefenseIcons(!isPlayerTurn); EnemyBlock.ToggleAttackIcons(!isPlayerTurn); EnemyBlock.ToggleDefenseIcons(isPlayerTurn); PlayerBlock.OnMovementFinished += BattleBlock_OnMovementFinished; EnemyBlock.OnMovementFinished += BattleBlock_OnMovementFinished; EnemyDefend(); }
public void EndTurn() { // currentAttacksCounter = 0; currentBlocksCounter = 0; PlayerBlock.UpdateInfo(); EnemyBlock.UpdateInfo(); PlayerChar.BlockedBodyParts.Clear(); EnemyChar.BlockedBodyParts.Clear(); BodyPartsToAttack.Clear(); if (DefendingChar.HP <= 0) { Close(); return; } isPlayerTurn = !isPlayerTurn; BattleShip tempChar = AttackingChar; AttackingChar = DefendingChar; DefendingChar = tempChar; BattleCharBlock tempBlock = AttackingCharBlock; AttackingCharBlock = DefendingCharBlock; DefendingCharBlock = tempBlock; PlayerBlock.ToggleTargets(!isPlayerTurn); EnemyBlock.ToggleTargets(isPlayerTurn); PlayerBlock.ToggleAttackIcons(isPlayerTurn); PlayerBlock.ToggleDefenseIcons(!isPlayerTurn); EnemyBlock.ToggleAttackIcons(!isPlayerTurn); EnemyBlock.ToggleDefenseIcons(isPlayerTurn); if (isPlayerTurn) { EnemyDefend(); } PlayerBlock.ResetTargets(); EnemyBlock.ResetTargets(); }