public override void Update(GameTime gameTime) { shadow.Update(gameTime); //world classe maken currentLevel.Update(shadow); Debug.WriteLine(currentLevel.CollisionCoins.Count); if (Global.currentLevel == 1) { currentLevel = levelTwo; if (!isInitiatedLevel) { currentLevel.CreateWorld(25); isInitiatedLevel = true; } } else if (Global.currentLevel == 2) { _game.ChangeState(new VictoryState(_game, _graphicsDevice, _content)); currentLevel = levelOne; Global.currentLevel = 0; } if (shadow.Position.Y > Global.screenHeight) { _game.ChangeState(new GameOverState(_game, _graphicsDevice, _content)); currentLevel = levelOne; Global.currentLevel = 0; } }
/// <summary> /// Simple extension to assign / update a <see cref="IShadow{TItem}"/> when it has content within it, with /// updates being automatically wrapped in a <see cref="Transaction"/> /// </summary> /// <typeparam name="TItem"></typeparam> /// <param name="context"></param> /// <param name="shadow"></param> /// <param name="current"></param> /// <param name="next"></param> /// <param name="set"></param> /// <param name="clear"></param> public static void UpdateContent <TItem>(this IShadow shadow, IShadowContext context, IPrimitive current, IPrimitive next, Action <IShadow <TItem> > set, Action <IShadow <TItem> > clear) { var content = shadow.Get <IShadow <TItem> >(ContentKey); Shadow.Update(context, current, next, content, (s) => { Transaction.Current.Add(() => { shadow.Set <IShadow <TItem> >(ContentKey, s); set(s); }); }, (s) => { Transaction.Current.Add(() => { shadow.State.Delete <IShadow <TItem> >(ContentKey); clear(s); }); }); }
public void Update(GameTime gameTime) { Move((float)gameTime.ElapsedGameTime.TotalSeconds); shadow.Update(position, animation.frameWidth); animationManager.Update(gameTime); }