/// <summary> /// OnGUI is called for rendering and handling GUI events. /// This function can be called multiple times per frame (one call per event). /// </summary> public void OnSceneGUI() { happyCheckStep = target as HappyCheckStep; Handles.color = Color.white; if (mainData == null) { mainData = GameObject.Find("MainData").GetComponent <MainData>(); } if (happyCheckStep.ufaMap == null) { return; } if (happyCheckStep.sortIndex < happyCheckStep.ufaIndexes.Length) { HCArea ufa = happyCheckStep.GetUfa(happyCheckStep.sortIndex); Handles.color = Color.yellow; Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap); } foreach (var index in happyCheckStep.stack) { HCArea ufa = happyCheckStep.GetUfa(index); Handles.color = happyCheckStep.numberCount == 0 ? Color.green : Color.red; Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.CylinderHandleCap); } for (int i = 0; i < happyCheckStep.ufaIndexes.Length; i++) { if (happyCheckStep.ufaMap[happyCheckStep.GetUfa(i).pos] == 1) { HCArea ufa = happyCheckStep.GetUfa(i); Handles.color = Color.grey; Handles.Button(mainData.AreaPosWorld(ufa.pos.x, ufa.pos.y), Quaternion.identity, 0.5f, 0.5f, Handles.ArrowHandleCap); } } }
// Use this for initialization void Awake() { happyCheck = GameObject.Find("Algorithm").GetComponentInChildren <HappyCheck>(); happyCheckStep = GameObject.Find("Algorithm").GetComponentInChildren <HappyCheckStep>(); GameObject debugWithMap = new GameObject("Map"); debugWithMap.transform.parent = transform; watchList = debugWithMap.AddComponent(typeof(WatchList2DInScene)) as WatchList2DInScene; happyCheckStep.clickAction += changeMineDataForHappy; }