Beispiel #1
0
 void EnterBuildState()
 {
     if (currentState != gamePlayStates["Build"])
     {
         currentState = gamePlayStates["Build"];
         currentState.EnterState();
     }
     else
     {
         currentState.ExitState();
         currentState = gamePlayStates["Inspect"];
         currentState.EnterState();
     }
 }
Beispiel #2
0
        public override void EnterState()
        {
            // Initialize Inn container
            currentInn = new Inn("Prancing Pony");
            Controller.SetCurrentInn(currentInn);

            // Initialize gameplay states
            gamePlayStates = new Dictionary <string, GamePlayState>();
            gamePlayStates.Add("Inspect", new InspectPlayState(this));
            gamePlayStates.Add("Build", new BuildPlayState(this));
            // Initialize UI
            playStateUI = new PlayStateUI(this);
            playStateUI.SetCurrentInn(currentInn);
            playStateUI.InitializeUIText();

            currentState = gamePlayStates["Inspect"];

            // Set Background and UI entities

            entities.Add(new ImageEntity(Controller.TexManager.GetTexture("Background"),
                                         new Vector2((Controller.ScreenWidth - Controller.TexManager.GetTexture("Background").Width) / 2, 0),
                                         Color.White));

            // Create a texture for the grid lines
            texture1px = new Texture2D(Controller.GDevice.GraphicsDevice, 1, 1);
            texture1px.SetData(new Color[] { Color.White });

            hammerIcon = Controller.EntFactory.CreateIcon(GameVariables.IconTypes.BUILD, EnterBuildState);


            entities.Add(hammerIcon);

            innUpdateTimeRemaining = GameVariables.UpdateInnTimeInSeconds;

            Ready = true;
            base.EnterState();
        }