private bool TryMerge(Entity entity) { if (!(entity is Bubble)) { return(false); } Bubble bubble = entity as Bubble; Body body = bubble.body; if (body.is_merging) { return(false); } Resources.droplet_sound.Play(0.025f, ((float)rand.NextDouble() - 0.5f), 0); body.is_merging = true; // body.is_static = true; InterpolatorCollection.GetInstance().Create(0, 1, 0.2f, (interpolator) => { //body.position = Vector2.Lerp(body.position, bubble.body.position, interpolator.value); }, (interpolator) => { body.is_merging = false; body.position.X = -99999999; body.velocity *= 0.1f; } ); return(true); }
protected override void Update(GameTime gameTime) { double elapsed = gameTime.ElapsedGameTime.TotalSeconds; TimerCollection.GetInstance().Update(elapsed); InterpolatorCollection.GetInstance().Update(elapsed); input.Update(); screenmanager.Update(elapsed); }
public override void FadeOut() { InterpolatorCollection.GetInstance().Create(1, 0, transition_time, (i) => { fade_value = i.value; }, null); base.FadeOut(); }
public DynamicPanel(GuiManager manager, Rect rect) : base(manager, rect) { _timers = new TimerCollection(); _interpolators = new InterpolatorCollection(); }
public override void FadeIn() { InterpolatorCollection.GetInstance().Create(0, 1, transition_time, (i) => { alpha = i.value; }, null); base.FadeIn(); }