public override void Act(ScriptableActionData data) { if (data.collision != null) { var rotation = Quaternion.LookRotation(data.collision.impulse); InstantiateParticles(data.collisionPointAverage, rotation); } }
public override void Act(ScriptableActionData data) { var audioSource = data.target.GetComponent <AudioSource>(); if (!audioSource) { audioSource = data.target.AddComponent <AudioSource>(); } audioSource.PlayOneShot(clips.RandomElement()); }
void OnCollisionEnter(Collision collision) { if (collision.relativeVelocity.magnitude > impactThreshold) { var data = new ScriptableActionData() { target = gameObject, collision = collision }; impactActions.ForAll(action => action.Act(data)); } }
public abstract void Act(ScriptableActionData data);