Beispiel #1
0
        public void addNewAction(GameAction action, int xCoordinate, int yCoordinate)
        {
            /*Point? nullBucket = getBucketID(xCoordinate, yCoordinate);
            if (nullBucket == null) return;
            Point bucket = (Point)nullBucket;*/
            if (action.ActionType == ActionType.DirectAction)
            {
                this.actions.Add(action);
                this.buckets[xCoordinate, yCoordinate].addAction(action);

                ProcessingBucket[] localArea = getNeighbours(xCoordinate, yCoordinate);

                foreach (ProcessingBucket adjacentBucked in localArea)
                {
                    Rectangle targetPoint = grid.GetGridRectangleFromGridPoint(action.ActionDirection.Value);
                    adjacentBucked.InformCiviliansTarget(
                        new Vector2(targetPoint.Center.X, targetPoint.Center.Y)); ;
                }
            }
        }
Beispiel #2
0
 public static GameAction CreateNewActionFromAction(GameAction oldAction, Rectangle uiLocation)
 {
     GameAction newAction = new GameAction(oldAction.ActionType, uiLocation);
     newAction.SetContent(oldAction.shopImage, oldAction.dragImage, oldAction.dragImage);
     newAction.dragImage = oldAction.dragImage;
     newAction.shopImage = oldAction.shopImage;
     return newAction;
 }
        private void ActionPlaced(GameAction droppedAction, Point gridLocation, Rectangle gridPosition)
        {
            if (droppedAction.ActionType == ActionType.DirectAction)
            {
                //Get some more input
                realTimeState = RealTimeState.SelectingDestionation;
                actionToPoint = droppedAction;
                actionToPointLocation = gridLocation;

            }
            else
            {
                //we are done for this action
                droppedAction.PlaceAction(gridLocation, buckets, gridPosition);

                // Decrease remaining actions
                --actionsRemaining;

                //And replensh the ui
                actions.Add(GameAction.CreateNewActionFromAction(droppedAction, GetUiPosition(droppedAction.ActionType)));

                List<Civilian> nearbyCivilians = new List<Civilian>();
                ProcessingBucket[] adjacentBuckets = buckets.getNeighbours(gridLocation.X, gridLocation.Y);
                foreach (ProcessingBucket bucket in adjacentBuckets)
                {
                    nearbyCivilians.AddRange(bucket.GetCivilians().Where(member => member.IsDead == false));
                }

                currentResultsScreen= new AudioResultsScreen(nearbyCivilians, gridLocation.Y >= 9);

                parentScreen.ScreenManager.AddScreen(currentResultsScreen, parentScreen.ControllingPlayer);

                realTimeState = RealTimeState.DisplayingListen;

                //Are we done for today? -- NO PEOPLE CAN STILL MOVE
                /*if (actionsRemaining == 0)
                {
                    EndDay();
                }*/
            }
        }
 public void addAction(GameAction action)
 {
     //actions.Add(action);
 }