Exemplo n.º 1
0
    private void RightMouseClick()
    {
        GameObject hitObject = FindHitObject();

        if (hitObject != null)
        {
            if (hitObject.GetComponent <ISelectAble>() != null && hitObject.tag == "Country")
            {
                Country clickedCountry = hitObject.GetComponent <Country>();
                _currentPlayersturn = PlayerTurnHandler.GetCurrentPlayer();
                Player countryOwner = clickedCountry.GetPlayerOwner();

                if (PlayerTurnHandler.CurrentGameMode == PlayerTurnHandler.GameMode.Reinforcement)
                {
                    if (_currentPlayersturn == countryOwner && _currentPlayersturn.reinforcementsAvailable > 0)
                    {
                        clickedCountry.AddArmy();
                        _currentPlayersturn.reinforcementsAvailable--;
                    }
                }
                else if (PlayerTurnHandler.CurrentGameMode == PlayerTurnHandler.GameMode.Attack)
                {
                    //Check if the two countries are connected.
                    //Check if the country is enemy.
                    attackPanelObject.SetActive(true);
                    _attackPannel.StartAttack(_currentSelectedCountry, clickedCountry);
                }
                countryHandler.SetSelectedCountry(_currentSelectedCountry);
            }
        }
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     _currentPlayersturn = PlayerTurnHandler.GetCurrentPlayer();
 }