Exemplo n.º 1
0
        public void ChangeWorld(IDynamic dynamic, Direction direction)
        {
            switch (direction)
            {
            case Direction.Right:
                WorldOnFocus.RemoveDynamicEntity((Entity)dynamic);
                dynamic.ChangeWorld(WorldOnFocus.RightWorld, direction);
                WorldOnFocus.RightWorld.AddDynamicEntity((Entity)dynamic);
                break;

            case Direction.Left:
                WorldOnFocus.RemoveDynamicEntity((Entity)dynamic);
                dynamic.ChangeWorld(WorldOnFocus.LeftWorld, direction);
                WorldOnFocus.LeftWorld.AddDynamicEntity((Entity)dynamic);
                break;
            }

            if (!(dynamic is Cow))
            {
                return;
            }
            switch (direction)
            {
            case Direction.Right:
                WorldOnFocus = WorldOnFocus.RightWorld;
                break;

            case Direction.Left:
                WorldOnFocus = WorldOnFocus.LeftWorld;
                break;
            }
        }
Exemplo n.º 2
0
 public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
 {
     Debug.WriteLine(new Vector2(Mouse.GetState().X, Mouse.GetState().Y));
     AlertWindow?.Update();
     if (!coveredByOtherScreen && !otherScreenHasFocus && !_onPause)
     {
         _inGameTime += gameTime.ElapsedGameTime;
         Cow.Inventory.Update();
         Cow.CraftPanel.Update();
         WorldOnFocus.Update(gameTime);
     }
     base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
 }
Exemplo n.º 3
0
 public override void Draw(GameTime gameTime)
 {
     ScreenManager.SpriteBatch.Begin();
     WorldOnFocus.Draw(ScreenManager.SpriteBatch);
     Cow.CraftPanel.Draw(ScreenManager.SpriteBatch);
     Cow.ListBars.ForEach(statusBar => statusBar.Draw(ScreenManager.SpriteBatch));
     Cow.Inventory.Draw(ScreenManager.SpriteBatch, GameFonts["gameFont"]);
     if (_onPause)
     {
         ScreenManager.SpriteBatch.Draw(GameTextures["cleanTexture"], new Rectangle(0, 0, Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight), new Color(0, 0, 0, 30));
     }
     AlertWindow?.Draw(ScreenManager.SpriteBatch);
     ScreenManager.SpriteBatch.End();
     base.Draw(gameTime);
 }
Exemplo n.º 4
0
 private void CreateCow()
 {
     Cow = new Cow(this, WorldOnFocus, new Vector2(530, 400));
     WorldOnFocus.AddDynamicEntity(Cow);
 }