22 lines
532 B
C#
22 lines
532 B
C#
using UnityEngine;
|
|
|
|
public class CubeClash_WindGust : MonoBehaviour
|
|
{
|
|
public float force = 15f;
|
|
public float lifeTime = 3f;
|
|
|
|
void Start()
|
|
{
|
|
Destroy(gameObject, lifeTime);
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.attachedRigidbody != null && other.CompareTag("Zibu"))
|
|
{
|
|
Vector3 dir = new Vector3(Random.Range(-1f,1f), 0, Random.Range(-1f,1f)).normalized;
|
|
other.attachedRigidbody.AddForce(dir * force, ForceMode.Impulse);
|
|
}
|
|
}
|
|
}
|