// Use this for initialization void Start() { GameObject tmpGo = gameObject; Action <SceneContinue> tmpCb = callBack; Action initCb = delegate() { GameObject go = GameObject.Instantiate(tmpGo); Scene scene = go.GetComponent <Scene>(); if (scene != null) { scene.resetWhenDisable = false; GameObject.Destroy(scene); } Light light = go.GetComponentInChildren <Light>(); if (light != null) { GameObject.Destroy(light); } go.name = COPY_NAME; go.transform.SetParent(tmpGo.transform.parent, false); GameObjectControl control = go.GetComponent <GameObjectControl>(); if (control != null && control.delUseNum != null) { control.delUseNum = null; } SceneContinue sceneContinue = tmpGo.AddComponent <SceneContinue>(); sceneContinue.SetCopy(go); go.SetActive(false); if (tmpCb != null) { tmpCb(sceneContinue); } }; SuperTween.Instance.DelayCall(0, initCb); GameObject.Destroy(this); }
private static Action GetCallBack(GameObject _go) { Action callBack = delegate() { GameObject go = GameObject.Instantiate(_go); GameObjectControl control = go.GetComponent <GameObjectControl>(); if (control != null && control.delUseNum != null) { control.delUseNum = null; } SceneContinue sceneContinue = _go.AddComponent <SceneContinue>(); sceneContinue.Init(go); }; return(callBack); }
static Action GetCallBack(GameObject _go) { Action callBack = delegate() { GameObject go = GameObject.Instantiate(_go); GameObjectControl control = _go.GetComponent <GameObjectControl>(); if (control != null) { GameObjectControl newControl = go.GetComponent <GameObjectControl>(); newControl.unit = control.unit; newControl.AddUseNum(); } SceneContinue sceneContinue = _go.AddComponent <SceneContinue>(); sceneContinue.Init(go); }; return(callBack); }