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(); }
private void FixedUpdate() { if (Vector3.Distance(transform.position, goPC.transform.position) >= flRange) { if (!boolFrozen) { transform.position = Vector3.MoveTowards(transform.position, goPC.transform.position, flMoveSpeed * Time.deltaTime); } } else { Collider[] Blast = Physics.OverlapSphere(transform.position, 3); foreach (Collider AffectedObject in Blast) { PC AffectedPC = AffectedObject.GetComponent <PC>(); if (AffectedPC != null) { AffectedPC.GrenadeHit(); } } Destroy(gameObject); } }
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 FireEvent() { var camera = AffectedObject.GetComponent <tk2dCamera>(); DOTween.To(() => camera.ZoomFactor, zf => camera.ZoomFactor = zf, 1.89f, Duration) .SetEase(Ease.OutCubic); }
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 FireEvent() { if (!animationClip) { Debug.Log("Attempting to play an animation on a GameObject but you haven't given the event an animation clip from USPlayAnimEvent::FireEvent"); return; } Animation animation = AffectedObject.GetComponent <Animation>(); if (!animation) { Debug.Log("Attempting to play an animation on a GameObject without an Animation Component from USPlayAnimEvent.FireEvent"); return; } animation.wrapMode = wrapMode; animation.Play(animationClip.name); AnimationState state = animation[animationClip.name]; if (!state) { return; } state.speed = playbackSpeed; }
public override void Process(float sequencerTime, float playbackRate) { if (!AffectedObject) { return; } for (var propertyIndex = 0; propertyIndex < propertyList.Count; propertyIndex++) { var property = propertyList[propertyIndex]; if (property != null) { if (!property.Component) { property.Component = AffectedObject.GetComponent(property.ComponentType); } if (property.Component && property.Component.transform != AffectedObject) { property.Component = AffectedObject.GetComponent(property.ComponentType); } property.SetValue(sequencerTime); } } }
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() { if (!AffectedObject) { Debug.Log("USSequencer is trying to play an audio clip, but you didn't give it Audio To Play from USPauseAudioEvent::FireEvent"); return; } var audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { Debug.Log("USSequencer is trying to play an audio source, but the GameObject doesn't contain an AudioClip from USPauseAudioEvent::FireEvent"); return; } if (pause) { audio.Pause(); } if (!pause) { audio.Play(); } }
void Update() { _combatantView = AffectedObject.GetComponent <CombatantView>(); var start = _mapView.GetDimensions().GetGridPositionForWorldPosition(AffectedObject.transform.position); var distance = MathUtils.ManhattanDistance(start, Destination); var secondsPerSquare = _combatantView.SecondsPerSquare; Duration = distance * secondsPerSquare; }
public override void UndoEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.stabilizeFeet = prevStabalizeFeet; }
public override void UndoEvent() { var animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.applyRootMotion = prevApplyRootMotion; }
public override void UndoEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.animatePhysics = prevAnimatePhysics; }
public override void UndoEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.speed = prevPlaybackSpeed; }
public override void ManuallySetTime(float deltaTime) { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { return; } audio.time = deltaTime; }
public override void ProcessEvent(float deltaTime) { if (Application.isPlaying) { return; } ParticleSystem particleSystem = AffectedObject.GetComponent <ParticleSystem>(); particleSystem.Simulate(deltaTime); }
public override void FireEvent() { var component = AffectedObject.GetComponent(ComponentName) as Behaviour; if (!component) { return; } prevEnable = component.enabled; component.enabled = enableComponent; }
public override void FireEvent() { Rigidbody affectedBody = AffectedObject.GetComponent <Rigidbody>(); if (!affectedBody) { Debug.Log("Attempting to Nullify a force on an object, but it has no rigid body from USSleepRigidBody::FireEvent"); return; } affectedBody.Sleep(); }
public override void UndoEvent() { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { Debug.LogWarning("Trying to fade audio on an object without an AudioSource"); return; } audio.volume = previousVolume; }
public override void LateBindAffectedObjectInScene(Transform newAffectedObject) { foreach (var property in propertyList) { if (property != null && property.Component == null) { property.Component = AffectedObject.GetComponent(property.ComponentType); } } base.LateBindAffectedObjectInScene(newAffectedObject); }
public override void FireEvent() { ParticleSystem particleSystem = AffectedObject.GetComponent <ParticleSystem>(); if (!particleSystem) { Debug.Log("Attempting to emit particles, but the object has no particleSystem USParticleEmitterStartEvent::FireEvent"); return; } particleSystem.Stop(); }
public override void ProcessEvent(float deltaTime) { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { Debug.LogWarning("Trying to fade audio on an object without an AudioSource"); return; } audio.volume = fadeCurve.Evaluate(deltaTime); }
public override void FireEvent() { var animation = AffectedObject.GetComponent <UnityEngine.Animation>(); if (!animation) { Debug.Log("Attempting to play an animation on a GameObject without an Animation Component from USPlayAnimEvent.FireEvent"); return; } animation[blendedAnimation.name].wrapMode = WrapMode.Once; animation[blendedAnimation.name].layer = 1; }
public override void FireEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { Debug.LogWarning("Affected Object has no Animator component, for uSequencer Event", this); return; } prevPlaybackSpeed = animator.speed; animator.speed = playbackSpeed; }
public override void FireEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { Debug.LogWarning("Affected Object has no Animator component, for uSequencer Event", this); return; } prevAnimatePhysics = animator.animatePhysics; animator.animatePhysics = animatePhysics; }
public override void FireEvent() { var animator = AffectedObject.GetComponent <Animator>(); if (!animator) { Debug.LogWarning("Affected Object has no Animator component, for uSequencer Event", this); return; } prevApplyRootMotion = animator.applyRootMotion; animator.applyRootMotion = applyRootMotion; }
public override void FireEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { Debug.LogWarning("Affected Object has no Animator component, for uSequencer Event", this); return; } prevStabalizeFeet = animator.stabilizeFeet; animator.stabilizeFeet = stabalizeFeet; }
public override void FireEvent() { Animation animation = AffectedObject.GetComponent <Animation>(); if (!animation) { Debug.Log("Attempting to play an animation on a GameObject without an Animation Component from USPlayAnimEvent.FireEvent"); return; } animation.wrapMode = WrapMode.Loop; animation.Play(animationClipSource.name); }
public override void FireEvent() { var affectedBody = AffectedObject.GetComponent <Rigidbody>(); if (!affectedBody) { Debug.Log("Attempting to apply an impulse to an object, but it has no rigid body from USequencerApplyImpulseEvent::FireEvent"); return; } affectedBody.AddForceAtPosition(direction * strength, transform.position, type); previousTransform = affectedBody.transform; }
public override void FireEvent() { if (AffectedObject != null) { cameraToAffect = AffectedObject.GetComponent <Camera>(); } if (cameraToAffect) { prevLayerMask = cameraToAffect.cullingMask; cameraToAffect.cullingMask = newLayerMask; } }