コード例 #1
0
    public bool areNeighbours(StatoController c1, StatoController c2)
    {
        string s1 = c1.gameObject.name;
        string s2 = c2.gameObject.name;

        return(areNeighbours(s1, s2));
    }
コード例 #2
0
 protected void Select(StatoController stato)
 {
     if (this._stateTemp == null && this.IsAValidFirst(stato))
     {
         this._stateTemp = stato;
         this._stateTemp.Toggle(true);
         return;
     }
     if (_stateTemp != null)
     {
         if (this.IsAValidSecond(stato))
         {
             stato.Toggle(true);
             if (EndSelection != null)
             {
                 EndSelection(this._stateTemp, stato);
             }
             this._stateTemp = null;
         }
         else if (this.IsAValidFirst(stato))
         {
             this._stateTemp.Toggle(false);
             this._stateTemp = stato;
             this._stateTemp.Toggle(true);
         }
     }
 }
コード例 #3
0
 private void UnToggle()
 {
     if (_stateTemp != null)
     {
         this._stateTemp.Toggle(false);
         this._stateTemp = null;
     }
 }
コード例 #4
0
 private void removeSelection()
 {
     _statoDifesa.Toggle(false);
     _statoAttacco.Toggle(false);
     _statoAttacco = null;
     _statoDifesa  = null;
     MainManager.GetInstance().StateClickEnabled = true;
 }
コード例 #5
0
 private void removeSelection()
 {
     _statoFrom.Toggle(false);
     _statoTo.Toggle(false);
     _statoFrom = null;
     _statoTo   = null;
     MainManager.GetInstance().StateClickEnabled = true;
 }
コード例 #6
0
    public void Remove(StatoController s)
    {
        PhaseManager phaseman = (PhaseManager)MainManager.GetManagerInstance("PhaseManager");

        if (this.currentChanges.Contains(s) && s.Player.Equals(phaseman.CurrentPlayer))
        {
            s.TankNumber -= 1;
            s.Player.ArmateDaAssegnare++;
            this.currentChanges.Remove(s);
        }
    }
コード例 #7
0
    public void Add(StatoController s)
    {
        PhaseManager phaseman = PhaseManager.GetInstance();

        if (s.Player.Equals(phaseman.CurrentPlayer) && s.Player.ArmateDaAssegnare > 0)
        {
            s.TankNumber += 1;
            s.Player.ArmateDaAssegnare--;
            this.currentChanges.Add(s);
            s.PlayAnimation("PlusOne");
            _guiController.Refresh();
        }
    }
コード例 #8
0
    private void handleSelection(StatoController statoFrom, StatoController statoTo)
    {
        this._statoFrom = statoFrom;
        this._statoTo   = statoTo;

        List <int> valuesRange = Enumerable.Range(1, _statoFrom.TankNumber - 1).ToList();

        if (statoFrom.TankNumber == 1)
        {
            this.removeSelection();
            return;
        }

        GameObject popup = this.myIstantiatePopup(_choicePopup);

        popup.GetComponent <ChoicePopupController>().initPopup("Sposta armate", "Scegli quante armate spostare", valuesRange);
        popup.GetComponent <ChoicePopupController>().AcceptPressed += handleChoicePopupAccepted;
        popup.GetComponent <ChoicePopupController>().CancelPressed += handleChoicePopupCancelled;
    }
コード例 #9
0
    private void handleSelection(StatoController statoAttacco, StatoController statoDifesa)
    {
        this._statoAttacco = statoAttacco;
        this._statoDifesa  = statoDifesa;

        int numArmatiMax = _statoAttacco.TankNumber > 3 ? 3 : _statoAttacco.TankNumber - 1;  // Math.Min(statoAttacco.TankNumber, 3);

        if (numArmatiMax == 0)
        {
            this.removeSelection();
            return;
        }

        List <int> valuesRange = Enumerable.Range(1, numArmatiMax).ToList <int>();

        GameObject popup = this.myIstantiatePopup(_choicePopup);

        popup.GetComponent <ChoicePopupController>().initPopup("ATTACCO", "Scegli con quante armate attaccare", valuesRange);
        popup.GetComponent <ChoicePopupController>().AcceptPressed += handleChoicePopupAccepted;
        popup.GetComponent <ChoicePopupController>().CancelPressed += handleChoicePopupCancelled;
    }
コード例 #10
0
        protected override bool IsAValidSecond(StatoController s2)
        {
            BorderManager border = BorderManager.GetInstance();

            return(border.areNeighbours(_stateTemp, s2) && !_stateTemp.Player.Equals(s2.Player));
        }
コード例 #11
0
 protected override bool IsAValidFirst(StatoController s)
 {
     return(s.Player.Equals(this._currentPlayer) && s.TankNumber > 1);
 }
コード例 #12
0
 protected abstract bool IsAValidFirst(StatoController s);
コード例 #13
0
 protected abstract bool IsAValidSecond(StatoController s2);
コード例 #14
0
 protected override bool IsAValidSecond(StatoController s2)
 {
     return(false);
 }
コード例 #15
0
 protected override bool IsAValidFirst(StatoController s)
 {
     return(false);
 }
コード例 #16
0
 private void HandleConquered(StatoController s)
 {
     Check();
 }