Esempio n. 1
0
    public void Enter(Player player)
    {
        Debug.Log(player.name + " entering move state");
        LoadPlayersFogOfWar(player);
        var mouseUI = player.mouseUI.GetComponent <MouseUI>();

        _mouse.Clear(mouseUI);
        drewMouseSuggestions = false;
        _gameMap.CheckAndHideGameEntities(player);
        _playerFogOfWar.ChangeFogOfWar(player, player.revealAlphaLevel);
        _playerFogOfWar.RevealPlayersRefineries(player);
    }
    public IEnumerator Move(Player player)
    {
        PlayMoveSoundEffect();
        var mouseUI = player.mouseUI.GetComponent <MouseUI>();

        _mouse.Clear(mouseUI);
        _playerFogOfWar.ChangeFogOfWar(player, player.visitedAlphaLevel);
        _playerFogOfWar.RevealPlayersRefineries(player);

        player._isMoving = true;
        var startPos = player.transform.position;
        var t        = 0f;

        var endPos = new Vector3(GetMousePos(player).x, GetMousePos(player).y, startPos.z);

        while (player.transform.position != endPos)
        {
            t += Time.deltaTime * player.moveSpeed;
            player.transform.position = Vector3.Lerp(startPos, endPos, t);
            yield return(null);
        }

        _playerFogOfWar.ChangeFogOfWar(player, player.revealAlphaLevel);
        player._isMoving = false;
        AddAllTilesOf(player);
        _playerMoney.CheckIfOnMoney(player);
        _gameMap.CheckAndHideGameEntities(player);

        // check if more moves are available
        if (_gameSceneManager.numberOfMoves > 0)
        {
            _mouse.DrawMoveSuggestions(player);
        }

        yield return(0);
    }
Esempio n. 3
0
 public void Exit(Player player)
 {
     _gameMap.CheckAndHideGameEntities(player);
     _playerFogOfWar.ChangeFogOfWar(player, player.revealAlphaLevel);
     _playerFogOfWar.RevealPlayersRefineries(player);
 }