using system;
using UnityEngine;
[Serializable]
public class Plasma : MonoBehaviour
{
public GlobalVars GlobalHealth;
public GameObject GlobalVarsS;
private int I;
private int NowUp = 1;
public int SpeedDelenie = 2;
public int Up = 60;
public override void Main()
{
}
public override void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
GameObject.Find("RedPlasmaSound").audio.Play();
if (this.GlobalHealth.Health > 10)
{
this.GlobalHealth.Health -= 10;
}
else
{
this.GlobalHealth.Health = 0;
}
}
}
public override void Start()
{
this.GlobalVarsS = GameObject.Find("GlobalVars");
this.
GlobalHealth =
(GlobalVars
) this.
GlobalVarsS.
GetComponent(typeof(GlobalVars
));
}
public override void Update()
{
this.
gameObject.
transform.
Rotate(new Vector3
((float) 0,
(float) 1,
(float) 0));
if (this.NowUp == 1)
{
this.I++;
this.gameObject.transform.position += (Vector3) (Vector3.up / ((float) this.SpeedDelenie));
if ((this.I == (this.Up - 1)) || (this.I == this.Up))
{
this.NowUp = 0;
this.gameObject.audio.Play();
}
}
else
{
this.I--;
this.gameObject.transform.position -= (Vector3) (Vector3.up / ((float) this.SpeedDelenie));
if ((this.I == ((this.Up + 1) - this.Up)) || (this.I == (this.Up - this.Up)))
{
this.NowUp = 1;
this.gameObject.audio.Play();
}
}
}
}