public IEnumerator StartNextTurn() { currentCharacter = turns[0]; Vector3 p = map.WorldToCellSpace(currentCharacter.transform.position); p.z = Camera.main.transform.localPosition.z; inputControl.CenterCamera(p); ui.UpdateTurns(turns); currentCharacter.OnTurnStart(); if (currentCharacter.GetHealth().x > 0) { if (currentCharacter.team == Card.TargetType.Enemy) { ai.self = currentCharacter; ai.Action(); } else { yield return(new WaitForSeconds(0.5f)); hand.DrawCurrentCards(currentCharacter); inputControl.SetInput(InputController.InputMode.Movement); map.Highlight(currentCharacter.transform.position, Card.RangeType.Area, currentCharacter.GetSpeed(), HighlightTiles.TileType.Move, currentCharacter.stats.moveableTiles); } ui.SelectCharacter(currentCharacter); } else { yield return(new WaitForSeconds(1.5f)); UpdateTurn(new List <Card>()); } }
public void EndCurrentTurn() { if (_playerTurn == 1) { if (_playerShooted) { foreach (var enemy in _enemies) { enemy.Action(_playerTurn); } _turnCounter++; _playerTurn++; NextTurnNotify(_playerTurn); _playerShooted = false; _playerSettedPosition = false; } else { Debug.Log("Somethink is wrong. You have to shoot"); } } else { if (_playerSettedPosition) { //Wywołaj akcję AI foreach (var enemy in _enemies) { enemy.Action(_playerTurn); } _turnCounter--; _playerTurn--; _playerSettedPosition = false; _playerShooted = false; NextTurnNotify(_playerTurn); } else { Debug.Log("Somethink is wrong. You have to set new position"); } } }