예제 #1
0
 public override void Act(ScriptableActionData data)
 {
     if (data.collision != null)
     {
         var rotation = Quaternion.LookRotation(data.collision.impulse);
         InstantiateParticles(data.collisionPointAverage, rotation);
     }
 }
예제 #2
0
    public override void Act(ScriptableActionData data)
    {
        var audioSource = data.target.GetComponent <AudioSource>();

        if (!audioSource)
        {
            audioSource = data.target.AddComponent <AudioSource>();
        }
        audioSource.PlayOneShot(clips.RandomElement());
    }
예제 #3
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.relativeVelocity.magnitude > impactThreshold)
     {
         var data = new ScriptableActionData()
         {
             target    = gameObject,
             collision = collision
         };
         impactActions.ForAll(action => action.Act(data));
     }
 }
예제 #4
0
 public abstract void Act(ScriptableActionData data);