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;
 }
Exemplo n.º 2
0
    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();
    }
Exemplo n.º 3
0
    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);
            }
        }
    }
Exemplo n.º 4
0
 public override void PerformAction(SelectableActionType actionType, GridCell targetCell, string param)
 {
     switch (actionType)
     {
     case SelectableActionType.ChangeGrid:
         this.ChangeGrid();
         break;
     }
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 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, "");
     }
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
 public abstract void PerformAction(SelectableActionType actionType, GridCell targetCell, string param);
Exemplo n.º 9
0
 /// 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);
 }
Exemplo n.º 10
0
 public void OnTryChangeGridEvent(MonoBehaviour grid)
 {
     this.selectedCell   = null;
     this.selectedAction = SelectableActionType.None;
     HidePopUp();
 }