34 lines
666 B
C#
34 lines
666 B
C#
using UnityEngine;
|
|
|
|
public class CubeClash_ShockZone : MonoBehaviour
|
|
{
|
|
public float chargeTime = 2f;
|
|
public float activeTime = 2f;
|
|
private float timer;
|
|
private bool active = false;
|
|
|
|
void Update()
|
|
{
|
|
timer += Time.deltaTime;
|
|
|
|
if (!active && timer >= chargeTime)
|
|
{
|
|
active = true;
|
|
timer = 0f;
|
|
}
|
|
else if (active && timer >= activeTime)
|
|
{
|
|
active = false;
|
|
timer = 0f;
|
|
}
|
|
}
|
|
|
|
private void OnTriggerStay(Collider other)
|
|
{
|
|
if (active && other.CompareTag("Zibu"))
|
|
{
|
|
Destroy(other.gameObject);
|
|
}
|
|
}
|
|
}
|