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 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 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) { 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 (!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(); } }
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 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 FireEvent() { if (!AffectedObject) { return; } if (bIsFireEvent == true) { return; } bIsFireEvent = true; if (!Application.isPlaying && Application.isEditor) { //previousColor = AffectedObject.GetComponent<Renderer>().sharedMaterial.color; //AffectedObject.GetComponent<Renderer>().sharedMaterial.color = newColor; AffectedObject.SetActive(active); } else { //previousColor = AffectedObject.GetComponent<Renderer>().material.color; //AffectedObject.GetComponent<Renderer>().material.color = newColor; AffectedObject.SetActive(active); } }
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); } }
private void OnTriggerEnter2D(Collider2D other) { var rb = other.attachedRigidbody; var dd = new AffectedObject(rb, slowDownCoeff); _affectedObjects.Add(other, dd); StartCoroutine(SlowDown(dd)); }
public override void UndoEvent() { if (!AffectedObject) { return; } AffectedObject.SetActive(prevEnable); }
public static Result <Modifier> AddModifier(AffectedObject affectedObject, string affectedValue, int value) { if (affectedValue == null) { return(Result.Failure <Modifier>("Modifier affected value must be named.")); } return(Result.Success(new Modifier(affectedObject, affectedValue, value))); }
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; }
private Modifier( AffectedObject affectedObject, string affectedValue, int value ) { AffectedObject = affectedObject; AffectedValue = affectedValue; Value = value; }
public Item( string name, AffectedObject affectedObject, string affectedValue, int value ) : this() { Name = name; Modifier = Modifier.AddModifier(affectedObject, affectedValue, value).Value; }
public override void ManuallySetTime(float deltaTime) { AudioSource audio = AffectedObject.GetComponent <AudioSource>(); if (!audio) { return; } audio.time = deltaTime; }
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.speed = prevPlaybackSpeed; }
public override void FireEvent() { PlayMakerFSM[] components = AffectedObject.GetComponents <PlayMakerFSM>(); foreach (PlayMakerFSM fsm in components) { if (fsm.FsmName == fsmInterfaceName) { fsm.Fsm.Event(eventName); } } }
public override void UndoEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.animatePhysics = prevAnimatePhysics; }
public override void ProcessEvent(float deltaTime) { if (Application.isPlaying) { return; } ParticleSystem particleSystem = AffectedObject.GetComponent <ParticleSystem>(); particleSystem.Simulate(deltaTime); }
public override void UndoEvent() { Animator animator = AffectedObject.GetComponent <Animator>(); if (!animator) { return; } animator.stabilizeFeet = prevStabalizeFeet; }
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 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() { var component = AffectedObject.GetComponent(ComponentName) as Behaviour; if (!component) { return; } prevEnable = component.enabled; component.enabled = enableComponent; }
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 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 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); }
private void VisualizeOtherAffectedObjects() { var IncludeOriginatedSubtree = (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)); var IncludeTargetedSubtree = (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)); var OtherAffectedObjects = OwnerManager.OwnerView.GetCurrentManipulableObjects(IncludeOriginatedSubtree, IncludeTargetedSubtree, true) .Select(obj => obj.Item1).Distinct() // Notice that duplicates are informed, so they must be excluded .Except(ManipulatedObject.IntoEnumerable()); // Exclude current object to avoid visual interference in resizing foreach (var AffectedObject in OtherAffectedObjects) { var DeltaX = 0.0; var DeltaY = 0.0; var DeltaWidth = 0.0; var DeltaHeight = 0.0; // Do not consider other intention, particularly resizing (due to its implicit move) if (IntendedAction == ESymbolManipulationAction.Move) { DeltaX = ManipulatingHeadingRectangle.X - ManipulatedSymbol.BaseArea.X; DeltaY = ManipulatingHeadingRectangle.Y - ManipulatedSymbol.BaseArea.Y; } // Only the manipulated symbol show a change in size // (because multi-resize is postponed due to difficulty) if (ManipulatedSymbol == AffectedObject) { DeltaWidth = ManipulatingHeadingRectangle.Width - ManipulatedSymbol.BaseArea.Width; DeltaHeight = ManipulatingHeadingRectangle.Height - ManipulatedSymbol.BaseArea.Height; } Rect SelectionZone = AffectedObject is VisualSymbol symbol && symbol.IsHidden ? new Rect(AffectedObject.BaseCenter.X - 4, AffectedObject.BaseCenter.Y - 4, 8, 8) : new Rect(AffectedObject.BaseLeft + DeltaX, AffectedObject.BaseTop + DeltaY, (AffectedObject.BaseWidth + DeltaWidth).EnforceMinimum(4), (AffectedObject.TotalArea.Height + DeltaHeight).EnforceMinimum(4)); var SelectionGeom = (SelectionZone.Width > 8 && SelectionZone.Height > 8 ? new CombinedGeometry(GeometryCombineMode.Exclude, new RectangleGeometry(SelectionZone), new RectangleGeometry(new Rect(SelectionZone.X + 4, SelectionZone.Y + 4, (SelectionZone.Width - 8).EnforceMinimum(4), (SelectionZone.Height - 8).EnforceMinimum(4)))) : (new RectangleGeometry(SelectionZone)) as Geometry); var SelectionDrawing = new GeometryDrawing(FrmStroke, FrmPencil, SelectionGeom); var SelectionVisual = SelectionDrawing.RenderToDrawingVisual(); SelectionVisual.Opacity = (AffectedObject.IsIn(OwnerManager.OwnerView.SelectedObjects) ? FrmOpacity : FrmOpacity / 2.0); Indicators.Add(SelectionVisual); } }