48 lines
777 B
C#
48 lines
777 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class LightningBolt : MonoBehaviour
|
|
{
|
|
public Material lightningBolt1;
|
|
|
|
public Material lightningBolt2;
|
|
|
|
public Material lightningBolt3;
|
|
|
|
private float timer;
|
|
|
|
public virtual void Start()
|
|
{
|
|
}
|
|
|
|
public virtual void Update()
|
|
{
|
|
timer += Time.deltaTime;
|
|
if (!(timer < 0.12f))
|
|
{
|
|
GetComponent<Renderer>().material = lightningBolt2;
|
|
}
|
|
if (!(timer < 0.24f))
|
|
{
|
|
GetComponent<Renderer>().material = lightningBolt3;
|
|
}
|
|
if (!(timer < 0.36f))
|
|
{
|
|
GetComponent<Renderer>().material = lightningBolt2;
|
|
}
|
|
if (!(timer < 0.48f))
|
|
{
|
|
GetComponent<Renderer>().material = lightningBolt1;
|
|
}
|
|
if (!(timer < 0.6f))
|
|
{
|
|
UnityEngine.Object.Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
}
|