public Level2(KinectInterface gameInput) { _levelBackground = ResourceManager.tex_background_level2; squick = new JumpingSquick(gameInput); squick.Pos = new Vector2(400, 800); squick.Speed = new Vector2(0,-600); toBeDestroy = new List<Entity>(); activeBranch = new Branch(gameInput); oldBranches = new List<Branch>(); cameraOffset = 0; fadeEffect = new Fade(); gauge = new Gauge(new Rectangle(30, 50, 10, 500), goal, Color.BurlyWood, Color.Gold); message = new Message("Training time !", new Vector2(20, 220), 2.0f, Message.DISPLAY_LBL, 50); hc = new HandCursors(); }
private void processJump(KinectInterface gameInput, GameTime gameTime, Branch b) { var later = Vector2.Add(squick.Bottom, Vector2.Multiply(squick.Speed, impactTrigger)); bool aboutToCross = b.isBelow(squick.Bottom) && b.isAbove(later); if (!aboutToCross) return; AudioManager.PlaySound(AudioManager.sound_jump); float oldSpeed = squick.Speed.Length(); Vector2 direction = Vector2.Reflect(squick.Speed, b.Normal); squick.Speed = Vector2.Multiply(Vector2.Normalize(direction), newSpeed(oldSpeed, b.BounceLength)); b.HitAndBreak(gameTime); if (b.Equals(activeBranch)) { oldBranches.Add(activeBranch); activeBranch = new Branch(gameInput); activeBranch.Update(gameTime); } }
private static bool destroyable(Branch b) { return b.Destroyable || b.Pos.Y > 1200; }