void OnDestroy() { MessageDispatcher.RemoveObserver(InitMap, MessageType.LoadBattleComplete); MessageDispatcher.RemoveObserver(MapShowEffectStart, MessageType.MapShowEffectStart); if (endlessModeManager != null) { endlessModeManager.OnDestroy(); endlessModeManager = null; } else if (trainingModeManager != null) { trainingModeManager.OnDestroy(); trainingModeManager = null; } else if (tutorialModeManager != null) { tutorialModeManager.OnDestroy(); tutorialModeManager = null; } logicWorld.Release(); logicWorld = null; renderWorld.Release(); renderWorld = null; }
private void InitPVEMode(BattleType type) { if (type == BattleType.Survival) { this.gameObject.AddComponent <LocalBattleMessageManager>(); endlessModeManager = new EndlessModeManager(); endlessModeManager.SetMapData(mapDataPVE); endlessModeManager.SetLogicWorld(logicWorld); endlessModeManager.InitEndlessMode(); } else if (type == BattleType.Tranining) { this.gameObject.AddComponent <LocalBattleMessageManager>(); trainingModeManager = new TrainingModeManager(); trainingModeManager.SetMapData(mapDataPVE); trainingModeManager.SetLogicWorld(logicWorld); trainingModeManager.InitTrainingMode(); } else if (type == BattleType.Tutorial) { //TODO: there need add tutorial manager, Dwayne. this.gameObject.AddComponent <LocalBattleMessageManager>(); tutorialModeManager = new TutorialModeManager(); tutorialModeManager.SetTutorialStage(dataManager.GetTutorialStage()); mapData1V1.SetTutorialPathPointPosition(); tutorialModeManager.SetMapData(mapData1V1); //Temp mapdata if have tutorial mapdata change this. tutorialModeManager.SetLogicworld(logicWorld); tutorialModeManager.SetMainCamera(this.mainCamera); tutorialModeManager.InitTutorialMode(); } else { DebugUtils.LogError(DebugUtils.Type.Data, "We just have two PVE Mode, Can not find this mode : " + type); } }
// Use this for initialization void Start() { RectTransform rect = Resources.Load <GameObject>("prefabs/MenuAction").GetComponent <RectTransform>(); offset = new Vector3(rect.rect.width, rect.rect.height, 0); player = GameObject.Find("Game Manager").GetComponent <TrainingModeManager>(); TextAsset menuData = Resources.Load("MenuXML") as TextAsset; playerType = Type.GetType("TrainingModeManager"); menuXML = new XmlDocument(); menuXML.LoadXml(menuData.text); XmlNode topNode = menuXML.ChildNodes[1].FirstChild; pointer = GetComponent <MenuController>(); pointer.Initialize(GenMenuList(topNode, transform, new Vector3(390, 130, 0))); }