Exemplo n.º 1
0
 public virtual void Activate()
 {
     // Ease interpolates minScale->maxScale, over 500 "time units"
     Tweenerizer.Ease(EasingType.EaseIn, minScale, maxScale, 500,
                      // update parameters with new easing values
                      (ease, incr) => scale = ease);
 }
Exemplo n.º 2
0
        public override void AssignCollector(Collector collector)
        {
            Tweenerizer.Ease(EasingType.EaseInOut, minOpacity, maxOpacity, 100, (ease, incr) =>
            {
                opacity = ease;
            });

            base.AssignCollector(collector);
        }
Exemplo n.º 3
0
        private void TriggerSuction(GameObject passenger, Wormhole endpoint)
        {
            float max = passenger.scale;

            passenger.disabled = true;
            Tweenerizer.Ease(EasingType.EaseIn, 0, 1, 300,
                             // update with easing
                             (ease, incr) => passenger.scale = max - (ease * max),
                             // on complete
                             () => {
                // move to new display
                Transport(passenger, endpoint);
                // scale back up
                Tweenerizer.Ease(EasingType.EaseOut, 0, 1, 300,
                                 (ease, incr) => passenger.scale = (ease * max));
                // it's aliiiiive!
                passenger.disabled = false;
            });
        }
Exemplo n.º 4
0
        protected override void Update(GameTime gameTime)
        {
            KeyboardState keyState   = Keyboard.GetState();
            MouseState    mouseState = Mouse.GetState();

            if (Keyboard.GetState().IsKeyDown(Keys.Escape) || Mouse.GetState().MiddleButton == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (mouseState.RightButton == ButtonState.Pressed && oldMouseState.RightButton == ButtonState.Released)
            {
                gamePaused = !gamePaused;
                Audio.Mute(gamePaused);
            }

            oldMouseState = mouseState;
            //if (gamePaused)  return;

            GridManager.Update();
            Tweenerizer.Update();
            Audio.Update();
            CloudManager.Update();

            /* For Testing - Accepts keyboard/mouse */
#if PRODUCTION
#else
            OrderedDictionary o = new OrderedDictionary();
            o.Add("id", 0);

            if (keyState.IsKeyDown(Keys.Up))
            {
                if (!oldState.IsKeyDown(Keys.Up))
                {
                    EventManager.Emit("user:bloat", o);
                }
            }
            else if (oldState.IsKeyDown(Keys.Up))
            {
                EventManager.Emit("user:bloatEnd", o);
            }

            if (keyState.IsKeyDown(Keys.Down))
            {
                if (!oldState.IsKeyDown(Keys.Down))
                {
                    EventManager.Emit("user:pinch", o);
                }
            }
            else if (oldState.IsKeyDown(Keys.Down))
            {
                EventManager.Emit("user:pinchEnd", o);
            }

            if (keyState.IsKeyDown(Keys.Space))
            {
                if (!oldState.IsKeyDown(Keys.Space))
                {
                    //o.Add("type", "theOcho");
                    //o.Add("value", 100);
                    o.Add("userId", 0);
                    EventManager.Emit("collector:attack", o);
                    //EventManager.Emit("user:getBadge", o);
                    //EventManager.Emit("user:getPoints", o);
                    //EventManager.Emit("user:disconnect", o);
                }
            }
            if (keyState.IsKeyDown(Keys.D1))
            {
                currentDisplay = 0;
            }
            else if (keyState.IsKeyDown(Keys.D2))
            {
                currentDisplay = 1;
            }
            else if (keyState.IsKeyDown(Keys.D3))
            {
                currentDisplay = 2;
            }
            else if (keyState.IsKeyDown(Keys.D4))
            {
                currentDisplay = 3;
            }

            oldState = keyState;

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                if (initialMousePos.Equals(Vector2.Zero))
                {
                    initialMousePos = new Vector2(mouseState.X, mouseState.Y);
                }
                o.Add("x", (int)(mouseState.X - initialMousePos.X));
                o.Add("y", (int)(mouseState.Y - initialMousePos.Y));
                EventManager.Emit("user:touch", o);
            }
            else if (mouseState.LeftButton == ButtonState.Released)
            {
                if (initialMousePos.Equals(Vector2.Zero))
                {
                    EventManager.Emit("user:touchEnd", o);
                }
                initialMousePos = Vector2.Zero;
            }
#endif

            //Camera update for movement
            ScreenManager.Update(gameTime);
            Light.Update(gameTime);

            /* End for testing */

            oldState = keyState;
            base.Update(gameTime);
        }