public static StickManager GetStick() { if (_stickmanager == null) { _stickmanager = new StickManager(); } return(_stickmanager); }
public void setCenterPoints() { StickManager stick = StickManager.GetStick(); _playerXCenter = (int)stick.X + 45; _playerYCenter = (int)stick.Y + 100; _playerRotationAngle = (int)stick.rotationAngle; }
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) { }; }
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) { } } }
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); } } }
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) { } } }
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(); } }
public PlayerOnStickState() { PlayerManager.CreatePlayerManager().CreateNewPlayer(); StickManager.GetStick().ResetAngle(); }