public void SetMode(ModeManagerMode mode) { if (currentMode == mode) { Debug.Log("same mode"); return; } if (currentMode == ModeManagerMode.Edit) { FindObjectOfType <EditManagerScript>().CancelCrop(); cursor.GetComponent <Renderer>().material.color = Color.green; } currentMode = mode; Debug.Log("changing mode"); foreach (Record rec in records) { if (rec.mode == currentMode) { rec.gameObject.SetActive(true); } else { rec.gameObject.SetActive(false); } } }
public void Register(GameObject obj, ModeManagerMode mode) { if (records == null) { records = new List <Record>(); } records.Add(new Record(obj, mode)); obj.SetActive(mode == ModeManagerMode.Init); }
public Record(GameObject obj, ModeManagerMode m) { gameObject = obj; mode = m; active = true; }