Esempio n. 1
0
 internal ThumbstickState NextState(Vector2 position, bool clicked, TimeSpan elapsed)
 {
     return(new ThumbstickState(position, position - Position,
                                Clicked.NextState(clicked, elapsed),
                                Up.NextState(MathHelper.Saturate(position.Y) > PressThreshold, elapsed),
                                Down.NextState(MathHelper.Saturate(-position.Y) > PressThreshold, elapsed),
                                Left.NextState(MathHelper.Saturate(-position.X) > PressThreshold, elapsed),
                                Right.NextState(MathHelper.Saturate(position.X) > PressThreshold, elapsed)));
 }
Esempio n. 2
0
        internal DirectionalState NextState(bool up, bool down, bool left, bool right, TimeSpan elapsed)
        {
            var direction = new Vector2(left ? -1 : right ? 1 : 0, up ? 1 : down ? -1 : 0);

            return(new DirectionalState(direction, direction - Direction,
                                        Up.NextState(up, elapsed),
                                        Down.NextState(down, elapsed),
                                        Left.NextState(left, elapsed),
                                        Right.NextState(right, elapsed)));
        }