public override void ProcessEvent(float deltaTime) { Animation animation = AffectedObject.GetComponent <Animation>(); if (!animation) { Debug.LogError("Trying to play an animation : " + animationClipSource.name + " but : " + AffectedObject + " doesn't have an animation component, we will add one, this time, though you should add it manually"); animation = AffectedObject.AddComponent <Animation>(); } if (animation[animationClipSource.name] == null) { Debug.LogError("Trying to play an animation : " + animationClipSource.name + " but it isn't in the animation list. I will add it, this time, though you should add it manually."); animation.AddClip(animationClipSource, animationClipSource.name); } if (animation[animationClipDest.name] == null) { Debug.LogError("Trying to play an animation : " + animationClipDest.name + " but it isn't in the animation list. I will add it, this time, though you should add it manually."); animation.AddClip(animationClipDest, animationClipDest.name); } if (deltaTime < blendPoint) { animation.CrossFade(animationClipSource.name); } else { animation.CrossFade(animationClipDest.name); } }
public override void ProcessEvent(float deltaTime) { Animation animation = AffectedObject.GetComponent <Animation>(); if (!animationClip) { return; } if (!animation) { Debug.LogError("Trying to play an animation : " + animationClip.name + " but : " + AffectedObject + " doesn't have an animation component, we will add one, this time, though you should add it manually"); animation = AffectedObject.AddComponent <Animation>(); } if (animation[animationClip.name] == null) { Debug.LogError("Trying to play an animation : " + animationClip.name + " but it isn't in the animation list. I will add it, this time, though you should add it manually."); animation.AddClip(animationClip, animationClip.name); } AnimationState state = animation[animationClip.name]; if (!animation.IsPlaying(animationClip.name)) { animation.wrapMode = wrapMode; animation.Play(animationClip.name); } state.speed = playbackSpeed; state.time = deltaTime * playbackSpeed; state.enabled = true; animation.Sample(); state.enabled = false; }
public override void ProcessEvent(float deltaTime) { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { audio = AffectedObject.AddComponent <AudioSource>(); audio.playOnAwake = false; } if (audio.clip != audioClip) { audio.clip = audioClip; } if (audio.isPlaying) { return; } audio.time = deltaTime; if (Sequence.IsPlaying && !audio.isPlaying) { audio.Play(); } }
public override void FireEvent() { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { audio = AffectedObject.AddComponent <AudioSource>(); audio.playOnAwake = false; } if (audio.clip != audioClip) { audio.clip = audioClip; } audio.time = 0.0f; audio.loop = loop; if (!Sequence.IsPlaying) { return; } audio.Play(); }
public override void FireEvent() { if (!Application.isPlaying && Application.isEditor) { } else { if (AffectedObject != null) { fade = AffectedObject.AddComponent <ScreenCameraFade>(); fade.fTimeFade = this.Duration; fade.bOutFade = bOutFade; } } }