public override void OnCommandResponse(object response) { if ((int)response == LitWindupSpeed) { Animation windupAnim = User.AnimManager.GetAnimation(WindupAnimName); windupAnim?.SetSpeed(2f); } }
protected override void OnUpdate() { //End and return if the BattleEntity is null if (Entity == null) { Debug.LogError($"{nameof(Entity)} is null! Ending BattleEvent"); End(); return; } ElapsedTime += Time.ElapsedMilliseconds; //First, perform a very quick hop up to show that the BattleEntity is frightened if (FrightState == FrightStates.HoppingUp) { Entity.Position = Interpolation.Interpolate(StartPos, HopEndPos, ElapsedTime / HopTime, Interpolation.InterpolationTypes.CubicIn); if (ElapsedTime >= HopTime) { ElapsedTime = 0d; FrightState = FrightStates.HoppingDown; } } //Go down from the hop else if (FrightState == FrightStates.HoppingDown) { Entity.Position = Interpolation.Interpolate(HopEndPos, StartPos, ElapsedTime / HopTime, Interpolation.InterpolationTypes.CubicOut); if (ElapsedTime >= HopTime) { ElapsedTime = 0d; FrightState = FrightStates.Running; //Play the running animation Entity.AnimManager.PlayAnimation(AnimationGlobals.RunningName, true); //Speed up the animation to make it look like the BattleEntity is running in panic Animation anim = Entity.AnimManager.GetAnimation <Animation>(AnimationGlobals.RunningName); anim?.SetSpeed(3f); Entity.SpriteFlip = true; } } //Run away else { Entity.Position += RunSpeed; if (ElapsedTime >= Duration) { End(); } } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: //Speed up the animation to the desired value, then end the sequence Anim?.SetSpeed(SpeedValue); EndSequence(); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: string animName = AnimationGlobals.RunningName; //Make the run animation slower Animation runAnim = User.AnimManager.GetAnimation(animName); runAnim?.SetSpeed(.5f); User.AnimManager.PlayAnimation(animName, true); CurSequenceAction = new WaitSeqAction(WaitDur); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }