Наследование: HaxxitGameState
Пример #1
0
 public MapMovementGameState(MapPlayGameState background_state, Haxxit.Maps.Point selected_program)
 {
     user_map_state = background_state;
     this.selected_program = selected_program;
     MoveAI = false;
     popTime = -1;
 }
Пример #2
0
 public MapAttackGameState(MapPlayGameState background_state, Haxxit.Maps.Point selected_program, string selected_attack)
 {
     user_map_state = background_state;
     this.selected_program = selected_program;
     this.selected_attack = selected_attack;
     commandAI = false;
     popTime = -1;
 }
Пример #3
0
 // Constructor
 public PlayerAI(string name = "")
     : base(name)
 {
     state = AIState.Waiting;
     map = null;
     turnActions = new Queue<NotifyArgs>();
     waitingToSend = false;
     pushedState = false;
     departureTime = 0;
     friendlyPrograms = new List<Haxxit.Maps.ProgramHeadNode>();
     enemyPrograms = new List<Haxxit.Maps.ProgramHeadNode>();
     mapData = null;
     backgroundState = null;
 }
 public override void OnFinishedClick(DrawableRectangle rectangle)
 {
     display_map_state.Map.FinishedSpawning();
     //UserMapGameState new_state = new UserMapGameState(user_map_state.Map);
     //MapPlayGameState new_state = new MapPlayGameState(display_map_state);
     if (tutorialPlayer.CurrentNode == "Node2")
     {
         MapPlayGameState new_state = new MapPlayGameState(display_map_state);
         _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));
     }
     else
     {
         TutorialState new_state = new TutorialState(display_map_state);
         _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));
     }
 }
Пример #5
0
 // This is the entry point to all AI routines.  It may be called multiple times
 // concurrently by the engine, so an AIState variable is used to direct execution
 // flow after each call and prevent duplicate calculations.
 public void HandleAITurn(Haxxit.Maps.Map currentMap, GameStates.MapPlayGameState newBackgroundState)
 {
     backgroundState = newBackgroundState;
     if(state == AIState.Planning)
     {
         return; // Let the AI finish planning the turn
     }
     else if (state == AIState.Sending)
     {
         SendActions();
     }
     else // state == AIState.waiting
     {
         state = AIState.Planning; // Planning to plan...
         map = currentMap;
         GetMapData(); // Load and restructure Map data for AI usage
         PlanTurn();   // Begin planning
         state = AIState.Sending;
     }
 }
Пример #6
0
        public override void Update()
        {
            MouseState mouse_state = Mouse.GetState(); // Gets the mouse state object
            Point mouse_position = new Point(mouse_state.X, mouse_state.Y); // creates a point for the mouse's position

            if (isContinueButtonClicked)
            {
                if (mouse_state.LeftButton == ButtonState.Released)
                {
                    if (mPlayer1Tutorial.SpawnTutorial == true)
                    {
                        mPlayer1Tutorial.SpawnTutorial = false;
                        TutorialMapSpawnGameState new_state = new TutorialMapSpawnGameState(display_map_state);
                        _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));
                    }
                    else if (mPlayer1Tutorial.level2Tutorial == true)
                    {
                        mPlayer1Tutorial.level2Tutorial = false;
                        TutorialMapSpawnGameState new_state = new TutorialMapSpawnGameState(display_map_state);
                        _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));

                    }
                    else
                    {
                        MapPlayGameState new_state = new MapPlayGameState(display_map_state);
                        _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));
                    }
                }
            }

            //Update for Continue Button
            if (ContinueButtonRect.Contains(mouse_position) && mouse_state.LeftButton == ButtonState.Pressed)
            {
                isContinueButtonClicked = true;
            }
            // if hovering over rectangle
            else if (ContinueButtonRect.Contains(mouse_position))
            {
            }
            else // neither clicking nor hovering over rectangle
            {
                isContinueButtonClicked = false;
            }
        }
Пример #7
0
 public virtual void OnFinishedClick(DrawableRectangle rectangle)
 {
     display_map_state.Map.FinishedSpawning();
     MapPlayGameState new_state = new MapPlayGameState(display_map_state);
     _mediator_manager.Notify("haxxit.engine.state.change", this, new ChangeStateEventArgs(new_state));
 }