public bool areNeighbours(StatoController c1, StatoController c2) { string s1 = c1.gameObject.name; string s2 = c2.gameObject.name; return(areNeighbours(s1, s2)); }
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); } } }
private void UnToggle() { if (_stateTemp != null) { this._stateTemp.Toggle(false); this._stateTemp = null; } }
private void removeSelection() { _statoDifesa.Toggle(false); _statoAttacco.Toggle(false); _statoAttacco = null; _statoDifesa = null; MainManager.GetInstance().StateClickEnabled = true; }
private void removeSelection() { _statoFrom.Toggle(false); _statoTo.Toggle(false); _statoFrom = null; _statoTo = null; MainManager.GetInstance().StateClickEnabled = true; }
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); } }
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(); } }
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; }
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; }
protected override bool IsAValidSecond(StatoController s2) { BorderManager border = BorderManager.GetInstance(); return(border.areNeighbours(_stateTemp, s2) && !_stateTemp.Player.Equals(s2.Player)); }
protected override bool IsAValidFirst(StatoController s) { return(s.Player.Equals(this._currentPlayer) && s.TankNumber > 1); }
protected abstract bool IsAValidFirst(StatoController s);
protected abstract bool IsAValidSecond(StatoController s2);
protected override bool IsAValidSecond(StatoController s2) { return(false); }
protected override bool IsAValidFirst(StatoController s) { return(false); }
private void HandleConquered(StatoController s) { Check(); }