public void OnCubeClicked(CubeBehavior cube) { if (cube.myColor == 0) { if (activeCube != null) { if (Mathf.Abs(activeCube.myX - cube.myX) <= 1 && Mathf.Abs(activeCube.myY - cube.myY) <= 1) { cube.setColor(activeCube.myColor); activeCube.setColor(0); } } } else { (cube.GetComponent("Halo") as Behaviour).enabled = true; (activeCube.GetComponent("Halo") as Behaviour).enabled = false; activeCube = cube; } }
// Use this for initialization void Start() { getFlag = getFlag.GetComponent <CubeBehavior>(); value = true; this.gameObject.transform.rotation = Quaternion.identity; }