Пример #1
0
 public static StickManager GetStick()
 {
     if (_stickmanager == null)
     {
         _stickmanager = new StickManager();
     }
     return(_stickmanager);
 }
Пример #2
0
        public void setCenterPoints()
        {
            StickManager stick = StickManager.GetStick();

            _playerXCenter       = (int)stick.X + 45;
            _playerYCenter       = (int)stick.Y + 100;
            _playerRotationAngle = (int)stick.rotationAngle;
        }
Пример #3
0
 public void RenderWholeWorld()
 {
     try {
         Device.Clear(ClearFlags.Target, DeviceColor, 0, 1);
         Device.BeginScene();
         TargetsManager.CreateTargets().RenderTarget();
         StickManager.GetStick().RenderStick();
         PlayerManager.CreatePlayerManager().PlayerRender(Device);
         ScoreManager.GetScoreManager().RenderScore(Device);
         HangingMoodie.CreatehHangingMoodie().Render();
         Device.EndScene();
         Device.Present();
     }catch (Exception) { };
 }
Пример #4
0
        public void DrawMoodie()
        {
            StickManager stick = StickManager.GetStick();

            using (Sprite DrawMoodie = new Sprite(GameAppFramework.GetGameAppFramework().Device))
            {
                try {
                    DrawMoodie.Begin(SpriteFlags.AlphaBlend);
                    Matrix matrix = new Matrix();
                    matrix = Matrix.Transformation2D(new Vector2(0, 0), 0f, new Vector2(1.0f, 1.0f), new Vector2(stick.X + 45, stick.Y + 100), 0.0f, new Vector2(0, 0));
                    DrawMoodie.Transform = matrix;
                    DrawMoodie.Draw(texture, new Rectangle(0, 0, 0, 0), new Vector3(0, 0, 0), new Vector3(x, y, 0), Color.White);
                    DrawMoodie.End();
                }
                catch (Exception e) { }
            }
        }
Пример #5
0
 public void OnNotify(Event ievent)
 {
     if (ievent is KeyPressedEvent)
     {
         if (((KeyPressedEvent)ievent).key == Keys.key.Left || ((KeyPressedEvent)ievent).key == Keys.key.Right)
         {
             StickManager.GetStick().StickUpdate(((KeyPressedEvent)ievent).key);
         }
         else if (((KeyPressedEvent)ievent).key == Keys.key.Up)
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerInAirState(), false);
         }
         else if (((KeyPressedEvent)ievent).key == Keys.key.Escape)
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(null, false);
         }
     }
 }
Пример #6
0
        public void PlayerRender(Device device)
        {
            StickManager stick = StickManager.GetStick();

            using (Sprite DrawPlayer = new Sprite(device))
            {
                try
                {
                    DrawPlayer.Begin(SpriteFlags.AlphaBlend);
                    Matrix matrix = new Matrix();
                    matrix = Matrix.Transformation2D(new Vector2(0, 0), 0f, new Vector2(1.0f, 1.0f), new Vector2(GetPlayerX() + 25, GetPlayerY() + 25), 0.1f, new Vector2(0, 0));//(float)(Math.PI - playerRotationAngle), new Vector2(0,0));
                    DrawPlayer.Transform = matrix;
                    DrawPlayer.Draw(_player.getTexture(), new Rectangle(0, 0, 0, 0), new Vector3(0, 0, 0), new Vector3(GetPlayerX(), GetPlayerY(), 0), Color.White);
                    DrawPlayer.End();
                }
                catch (Exception e) { }
            }
        }
Пример #7
0
        public void PlayerUpdate()
        {
            var          targets = TargetsManager.CreateTargets().MoodieList;
            StickManager stick   = StickManager.GetStick();
            double       yAngle  = Math.Sin(stick.rotationAngle - Math.PI / 2);
            double       xAngle  = Math.Cos(stick.rotationAngle - Math.PI / 2);

            if (!isWall() && !_wall)
            {
                SetPlayerX((int)((GetPlayerX()) + (25 * xAngle)));
                SetPlayerY((int)((GetPlayerY()) + (25 * yAngle)));
            }
            else
            {
                SetPlayerX((int)((GetPlayerX()) - (25 * xAngle)));
                SetPlayerY((int)((GetPlayerY()) + (25 * yAngle)));
            }
            if (targets[targets.Count - 1][0].GetYCoordinate() >= GetPlayerY() - 36)
            {
                CollisionManager.GetCollisionManager().HandleCollision();
            }
        }
Пример #8
0
 public PlayerOnStickState()
 {
     PlayerManager.CreatePlayerManager().CreateNewPlayer();
     StickManager.GetStick().ResetAngle();
 }