void OnTriggerEnter() { switch (cubeState) { case EStateCube.GOALMODE: // Win some points OnDestroyObject(); transform.parent.GetComponent<Score>().TouchedCube(); cubeState = EStateCube.DESTROY; break; } }
// Use this for initialization void Start () { cubeState = EStateCube.NOTHING; timeLeft = GamePlay.timeBetweenEachCubeApparition; if (!transform.parent.name.Contains("Cube")) { GameObject child = GameObject.Instantiate(this.gameObject); child.transform.parent = this.transform; Destroy(GetComponent<Renderer>()); Destroy(child.GetComponents<BoxCollider>()[1]); Destroy(child.GetComponent<Cube>()); BeginningColor = transform.GetChild(0).GetComponent<Renderer>().material.color; } }
public virtual void OnDeactivate() { resetColor = !resetColor; cubeState = EStateCube.NOTHING; }
public virtual void OnActivateGoal() { transform.parent.GetComponent<Score>().NewGoalCube(); cubeState = EStateCube.GOALMODE; }