public HeavyGameEventData( Faction sourceFaction = null, Faction targetFaction = null, GameObject targetObject = null, GridCell sourceCell = null, GridCell targetCell = null, InGameResource resourceValue = null, Recipe recipeValue = null, int intValue = 0, bool boolValue = false, float floatValue = 0.0f, string stringValue = "", Selectable targetSelectable = null, SelectableActionType actionType = SelectableActionType.None ) { this.SourceFaction = sourceFaction; this.TargetFaction = targetFaction; this.TargetObject = targetObject; this.SourceCell = sourceCell; this.TargetCell = targetCell; this.ResourceValue = resourceValue; this.RecipeValue = recipeValue; this.IntValue = intValue; this.BoolValue = boolValue; this.FloatValue = floatValue; this.StringValue = stringValue; this.ActionType = actionType; this.targetSelectable = targetSelectable; }
public void OnActionSelected(int actionInt) { this.ResetGridInViewTiles(); SelectableActionType selectedAction = (SelectableActionType)actionInt; if (selectedAction == SelectableActionType.Move) { this.ColorGridTiles(this.gridInView.GetGridCells().Where(c => c.ResourceDeposit == null && c.Selectable == null).ToList(), Constants.tileMove); this.ColorGridTiles(this.gridInView.GetCellsInRange(this.selectedCell, ((Unit)this.selectedCell.Selectable).GetMaxRange()) .Where(c => c.ResourceDeposit == null && c.Selectable == null).ToList(), Constants.tileMoveSingleTurn); } if (selectedAction == SelectableActionType.Build) { this.ColorGridTiles(this.gridInView.GetGridCells().Where(c => c.ResourceDeposit != null).ToList(), Constants.tileBuild); this.ColorGridTiles(this.gridInView.GetCellsInRange(this.selectedCell, 1), Constants.tileBuild); } if (selectedAction == SelectableActionType.Attack) { this.ColorGridTiles(this.gridInView.GetGridCells().Where(c => c.Selectable != null && c.Selectable is Unit && ((Unit)c.Selectable).Faction != ((Unit)this.selectedCell.Selectable).Faction).ToList(), Constants.tileAttack); this.ColorGridTiles(this.gridInView.GetCellsInRange(this.selectedCell, ((Unit)this.selectedCell.Selectable).GetAttackRange()), Constants.tileAttack); } this.selectedCell.tileShadingHandler.ResetColor(); }
public void OnGameStateManagerUpdated(MonoBehaviour _gameStateManager) { GameStateManager gs = (GameStateManager)_gameStateManager; this.isPlayerTurn = gs.IsPlayerTurn; this.factions = gs.Factions; this.selectedCell = gs.SelectedCell; this.gridInView = gs.GridInView; this.selectedAction = gs.SelectedAction; if (gs.SelectedCell == null) { HidePopUp(); } if (gs.SelectedAction == SelectableActionType.None) { this.ResetGridInViewTiles(); } if (gs.GridInView != null) { if (gs.GridInView.isSolarSystem) { solarSystemButton.SetActive(false); } else { solarSystemButton.SetActive(true); } } }
public override void PerformAction(SelectableActionType actionType, GridCell targetCell, string param) { switch (actionType) { case SelectableActionType.ChangeGrid: this.ChangeGrid(); break; } }
public virtual bool TryPerformAction(SelectableActionType actionType, GridCell targetCell, string param) { if (this.CanPerformAction(actionType, targetCell, param)) { this.PerformAction(actionType, targetCell, param); return(true); } return(false); }
private void onButtonPress(SelectableActionType actionType) { onActionSelectedEvent.Raise((int)actionType); if (actionType == SelectableActionType.Build) { this.loadBuildOptions(); } if (actionType == SelectableActionType.ChangeGrid) { ((Planet)this.parentSelectable).TryPerformAction(actionType, null, ""); } }
public override bool CanPerformAction(SelectableActionType actionType, GridCell targetCell, string param) { if (this.GetValidActionTypes().Contains(actionType)) { switch (actionType) { case SelectableActionType.ChangeGrid: /// Changes to view if same cell return(true); } } return(false); }
public abstract void PerformAction(SelectableActionType actionType, GridCell targetCell, string param);
/// Miner's don't have any selectable actions, so this should always return false /// (assuming they do not have movement) public override bool CanPerformAction(SelectableActionType actionType, GridCell targetCell, string param) { return(false); }
public void OnTryChangeGridEvent(MonoBehaviour grid) { this.selectedCell = null; this.selectedAction = SelectableActionType.None; HidePopUp(); }