void OnBodyMotion(object sender, BodyMotionDetectedEventArgs args) { Bonus bonus = new Bonus(); switch (args.motion) { case BodyMotion.JUMP: bonus = TargetsFactory.ReleaseAllBonusTargetsByType(TargetType.TopBonusTarget); break; case BodyMotion.SUPER_JUMP: bonus = TargetsFactory.ReleaseAllBonusTargetsByType(TargetType.BottomBonusTarget); break; } if (gameMode == GameMode.LimitedTime) { this.score += bonus.Score; this.timeLeft += bonus.Time; UpdateScoreText(); } else if (gameMode == GameMode.LimitedLife) { this.life += bonus.Life; UpdateLifesText(); } }
protected virtual void OnBodyMotionDetected(BodyMotion motion) { if (bodyMotionDetected != null) { BodyMotionDetectedEventArgs e = new BodyMotionDetectedEventArgs(); e.motion = motion; bodyMotionDetected(this, e); } }
void OnBodyMotion(object sender, BodyMotionDetectedEventArgs args) { Bonus bonus = new Bonus(); switch(args.motion) { case BodyMotion.JUMP: bonus = TargetsFactory.ReleaseAllBonusTargetsByType(TargetType.TopBonusTarget); break; case BodyMotion.SUPER_JUMP: bonus = TargetsFactory.ReleaseAllBonusTargetsByType(TargetType.BottomBonusTarget); break; } if (gameMode == GameMode.LimitedTime) { this.score += bonus.Score; this.timeLeft += bonus.Time; UpdateScoreText(); } else if (gameMode == GameMode.LimitedLife) { this.life += bonus.Life; UpdateLifesText(); } }