You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
823 B
26 lines
823 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class HitCheck_Particle : ResourcePool |
|
{ |
|
System.Action<Vector3> OnCreate; |
|
public void OnInitialized(Character owner, System.Action<Vector3> onCreate) |
|
{ |
|
OnCreate = onCreate; |
|
} |
|
[Space(10)] |
|
public ParticleSystem part; |
|
public float offset = 0.01f; |
|
private List<ParticleCollisionEvent> collisionEvents = new List<ParticleCollisionEvent>(); |
|
void OnParticleCollision(GameObject other) |
|
{ |
|
int numCollisionEvents = part.GetCollisionEvents(other, collisionEvents); |
|
for (int i = 0; i < numCollisionEvents; i++) |
|
{ |
|
Vector3 pos = collisionEvents[i].intersection + collisionEvents[i].normal; |
|
pos.y = offset; |
|
OnCreate(pos); |
|
} |
|
} |
|
}
|
|
|