// Use this for initialization void Awake() { mainCamera = Camera.main; click = GameObject.CreatePrimitive(PrimitiveType.Sphere); click.transform.SetParent(transform); click.GetComponent <SphereCollider>().enabled = false; grid = new SphereGrid(); string path = Application.dataPath + "/spheregrid.txt"; if (File.Exists(path)) { string text = File.ReadAllText(path); grid.ParseTilesType(text); } grid.Init(SphereRadius, SphereDetail); grid.SetRoot(transform); #if UNITY_EDITOR for (int i = 0; i < grid.tiles.Count; ++i) { grid.tiles[i].SetDefaultColor(); } #endif }
// Use this for initialization void Awake() { rotate = GetComponent <SphereRotate>(); if (rotate == null) { rotate = gameObject.AddComponent <SphereRotate>(); } click = GameObject.CreatePrimitive(PrimitiveType.Sphere); click.GetComponent <SphereCollider>().enabled = false; grid = new SphereGrid(); grid.Init(SphereRadius, SphereDetail); grid.SetRoot(transform); string path = Application.dataPath + "/spheregrid.txt"; if (File.Exists(path)) { string text = File.ReadAllText(path); grid.ParseTilesType(text); } for (int i = 0; i < grid.tiles.Count; ++i) { grid.tiles[i].SetDefaultColor(); } }