private static ActionEase GetRandomActionEase(MoveTo moveTo) { ActionEase ease; switch (Roll.d10) { case 1: ease = new EaseBackInOut(moveTo); break; case 2: ease = new EaseBackIn(moveTo); break; case 3: ease = new EaseBackOut(moveTo); break; case 4: ease = new EaseBounceInOut(moveTo); break; case 5: ease = new EaseElasticInOut(moveTo); break; case 6: ease = new EaseElasticOut(moveTo); break; case 7: ease = new EaseExponentialIn(moveTo); break; case 8: ease = new EaseExponentialInOut(moveTo); break; case 9: ease = new EaseExponentialOut(moveTo); break; case 10: ease = new EaseInOut(moveTo, 5f); break; default: ease = new EaseBackInOut(moveTo); break; } return(ease); }
protected override void OnUpdate(float timeStep) { var input = Input; const float duration = 1f; //2s FiniteTimeAction action = null; if (input.GetKeyPress(Key.W)) { action = new MoveBy(duration, new Vector3(0, 0, 5)); } if (input.GetKeyPress(Key.S)) { action = new MoveBy(duration, new Vector3(0, 0, -5)); } if (input.GetKeyPress(Key.E)) { action = new FadeIn(duration); } if (input.GetKeyPress(Key.Q)) { action = new FadeOut(duration); } if (input.GetKeyPress(Key.R)) { action = new EaseElasticInOut(new ScaleBy(duration, 1.3f)); } if (input.GetKeyPress(Key.G)) { action = new TintTo(duration, NextRandom(1), NextRandom(1), NextRandom(1)); } if (action != null) { //can be awaited boxNode.RunActionsAsync(action); } base.OnUpdate(timeStep); }