protected virtual void GenerateHUDStatsText(StringBuilder s) { s.AppendLine(GetType().Name); s.AppendLine(State.ToString()); s.Append("Hitpoints: ").Append(HitPoints).Append(" / ").Append(MaxHitPoints).AppendLine(); if (MotionUnit != null) { s.Append("Weight: ").Append(MotionUnit.Weight).AppendLine(); } s.Append("MovementBlockers: ").Append(CanControlMovementBlockers).AppendLine(); s.Append("RotationBlockers: ").Append(CanControlRotationBlockers).AppendLine(); s.Append("AbilityBlockers: ").Append(CanPerformAbilitiesBlockers).AppendLine(); s.Append("IsOnGround: ").Append(IsOnGround).AppendLine(); var ea = Scene.View.Content.Peek <global::Graphics.Renderer.Renderer.EntityAnimation>(MetaEntityAnimation); //s.Append("Animation: ").Append(ea.PlayingAnimations[ea.CurrentTrack]).Append(" "). // Append(ea.Looping[ea.CurrentTrack]).Append(" "). // Append(ea.TrackDurations[ea.CurrentTrack]).AppendLine(); s.AppendLine(ea.GetInformation()); s.Append("ActionAnimation: "); if (actionAnimation != null) { s.AppendLine(actionAnimation.Animation); } else { s.AppendLine("-"); } s.Append("JumpStage: ").AppendLine(JumpAnimationStage.ToString()); foreach (var v in Abilities) { if (this is NPC) { s.Append(v.AIPriority(this, Game.Instance.Map.MainCharacter.Translation, Game.Instance.Map.MainCharacter)).Append("|"); } s.Append("Ability ").Append(v.GetType().Name); if (v.IsPerforming) { s.Append(" PERFORMING "); } if (v.CurrentCooldown > 0) { s.Append(v.CurrentCooldown); } s.AppendLine(); } foreach (var v in ActiveBuffs) { s.Append("Buff ").Append(v.GetType().Name); if (v.IsPerforming) { s.Append(" PERFORMING"); } s.AppendLine(); } }
protected virtual void OnAnimationDone(int obj) { if (actionAnimationPlaying) { actionAnimation = null; actionAnimationPlaying = false; } if (JumpAnimationStage == JumpAnimationStage.Jump) { JumpAnimationStage = JumpAnimationStage.Falling; } else if (JumpAnimationStage == JumpAnimationStage.Land) { JumpAnimationStage = JumpAnimationStage.None; } InvalidateAnimation(); }
protected virtual void PlayJumpAnimation() { JumpAnimationStage = JumpAnimationStage.Jump; }
protected override void OnUpdateAnimation() { if (Scene == null) return; var ea = Scene.View.Content.Peek<global::Graphics.Renderer.Renderer.EntityAnimation>(MetaEntityAnimation); if (State == UnitState.Alive) { if (actionAnimation != null) { if (!actionAnimationPlaying) { actionAnimation.FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, actionAnimation.Animation); ea.PlayAnimation(actionAnimation); actionAnimationPlaying = true; JumpAnimationStage = JumpAnimationStage.None; } return; } if (IsOnGround) { if (Running && CanControlMovement) { if(JumpAnimationStage == JumpAnimationStage.Falling) JumpAnimationStage = JumpAnimationStage.None; if (RunningBackwards) { if (!ea.PlayingAnimation.StartsWith("Backing") || ea.Paused) { string animName = GetAnimationName(UnitAnimations.Backing); ea.PlayAnimation(new AnimationPlayParameters( animName, false, RunSpeed * BackingAnimationSpeed * GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed, 0) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); } ea.SetTrackAnimationSpeed(RunSpeed * BackingAnimationSpeed); } else { var animName = GetAnimationName(UnitAnimations.Run); float ras = RunAnimationSpeed; if (RunSpeed >= FastRunStartAtSpeed) { ras = FastRunAnimationSpeed; animName = GetAnimationName(UnitAnimations.FastRun); } if (!ea.PlayingAnimation.StartsWith("Run") || ea.Paused) { ea.PlayAnimation(new AnimationPlayParameters( animName, false, RunSpeed * ras * GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed, 0) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); } ea.SetTrackAnimationSpeed(RunSpeed * ras); } } else { if (JumpAnimationStage == JumpAnimationStage.Falling) { var animName = GetAnimationName(UnitAnimations.Land); ea.PlayAnimation(new AnimationPlayParameters(animName, false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.Land1).Play(new Client.Sound.PlayArgs { }); JumpAnimationStage = JumpAnimationStage.Land; return; } else { var an = GetAnimationName(IdleAnimation); var an2 = IdleAnimation.ToString(); if (!ea.PlayingAnimation.StartsWith(an2) || ea.Paused) ea.PlayAnimation(new AnimationPlayParameters(an, false, GetAnimationSpeedMultiplier(an), AnimationTimeType.Speed) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, an) }); return; } } } else { if (JumpAnimationStage == JumpAnimationStage.Jump) { if (!ea.PlayingAnimation.StartsWith("Jump")) { var animName = GetAnimationName(UnitAnimations.Jump); ea.PlayAnimation(new AnimationPlayParameters(animName, false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); } } else if (JumpAnimationStage == JumpAnimationStage.Falling) { if (!ea.PlayingAnimation.StartsWith("Falling")) { var animName = GetAnimationName(UnitAnimations.Falling); ea.PlayAnimation(new AnimationPlayParameters(animName, true, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); } } } } else if (State == UnitState.RaisingCorpse) { if (!ea.PlayingAnimation.StartsWith("RaiseDead")) { var animName = GetAnimationName(UnitAnimations.RaiseDead); ea.PlayAnimation(new AnimationPlayParameters(animName, false, RaiseFromCorpseTime * GetAnimationSpeedMultiplier(animName), AnimationTimeType.Length) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); } } else if (State == UnitState.Dead || State == UnitState.RaisableCorpse || State == UnitState.HoldCorpse) { if (!ea.PlayingAnimation.StartsWith("Death")) { var animName = GetAnimationName(UnitAnimations.Death); ea.PlayAnimation(new AnimationPlayParameters(animName, false, GetAnimationSpeedMultiplier(animName), AnimationTimeType.Speed, 0) { FadeTime = GetAnimationFadeTime(ea.PlayingAnimation, animName) }); if (Game.Instance != null) if (Game.Instance.FrameId < 30) ea.FreezeAtEnd(); } } }
protected virtual void OnAnimationDone(int obj) { if (actionAnimationPlaying) { actionAnimation = null; actionAnimationPlaying = false; } if (JumpAnimationStage == JumpAnimationStage.Jump) JumpAnimationStage = JumpAnimationStage.Falling; else if (JumpAnimationStage == JumpAnimationStage.Land) JumpAnimationStage = JumpAnimationStage.None; InvalidateAnimation(); }