public override void CustomUpdate() { component.GetCircleColliderComponent().SetCenterPosition(component.GetTransformComponent().GetPosition().X, component.GetTransformComponent().GetPosition().Y); component.GetActionComponent().StartAction("changeSprite"); if (isFalling) { if (component.GetTransformComponent().GetRotateAngle() < 1.5f) { component.GetTransformComponent().Rotate(0.03f); } component.GetTransformComponent().MoveDown(); if (SEKeyboardManager.CheckKeyDown(Keys.Space)) { Jump(); } } else { TimeSpan span = DateTime.Now - timeFalling; if ((span.TotalSeconds) > 0.2f) { component.GetTransformComponent().SetSpeed(fallingSpeed); isFalling = true; } component.GetTransformComponent().MoveUp(); } if ((GetComponent().GetTransformComponent().GetPositionY() > FlappyBirdProperties.GetGroundHeigth()) || (GetComponent().GetTransformComponent().GetPositionY() < 0)) { component.GetAudioSourceComponent().Play(@"FlappyBird\sfx_die"); Collapse(); } }
public override void Update() { if (FlappyBirdProperties.IsBirdFly()) { base.Update(); } else { if (FlappyBirdProperties.IsGameWaiting()) { bird.WaitRunGame(); } else { if (SEKeyboardManager.CheckKeyDown(Keys.Space)) { Reload(); } bird.GetComponent().GetCircleColliderComponent().SetCenterPosition(bird.GetComponent().GetTransformComponent().GetPosition().X, bird.GetComponent().GetTransformComponent().GetPosition().Y); if (bird.GetComponent().GetTransformComponent().GetPositionY() < FlappyBirdProperties.GetGroundHeigth()) { bird.GetComponent().GetTransformComponent().Rotate(0.02f); bird.GetComponent().GetTransformComponent().MoveDown(); } } } }
public void WaitRunGame() { component.GetActionComponent().StartAction("changeSprite"); if (SEKeyboardManager.CheckKeyDown(Keys.Space)) { Jump(); FlappyBirdProperties.SetBirdFlyStatus(true); FlappyBirdProperties.SetGameWaitingStatus(false); FlappyBirdProperties.GetTextLabel().SetEnable(false); } }
public override void CustomUpdate() { for (int i = 0; i < childs.Count; ++i) { if (SEKeyboardManager.IsKeyPressed(Keys.LeftControl) && childs[i].GetComponent().GetTransformComponent().GetRectangle().Contains(SEMouseManager.GetCursorPosition())) { childs[i].SetShowBorder(true); } else { childs[i].SetShowBorder(false); } } }