witchExample.cs
1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using System.Collections;
public class witchExample : MonoBehaviour {
Color[] colors = new Color[] { Color.red, Color.black, Color.white, Color.blue, Color.yellow };
public void ChangeColor(int color) //Change color to the one specified
{
if (color < colors.Length && color > 0)
{
GetComponent<Renderer>().material.color = colors[color];
} else
{
GetComponent<Renderer>().material.color = colors[2];
}
GetComponent<VIDE_Assign>().overrideStartNode = 16;
}
public void Move() //Move
{
transform.position += transform.forward * -5;
}
public void GoInvisible(bool visible)// GO invisible and change override start point
{
GetComponent<Renderer>().enabled = visible;
if (!visible)
{
GetComponent<VIDE_Assign>().overrideStartNode = 10;
} else
{
GetComponent<VIDE_Assign>().overrideStartNode = 0;
}
}
}