public void DestoryBattle() { UnlistenToPartiesAndCharactersEvents(); _fakeServer.Event_OnMove -= OnMove; _fakeServer.Event_OnReadyCome -= OnReadyCome; _secretController.Event_ActionGenerated -= OnActionGenerated; TimeManager.instance.Event_OneSecTick -= OnTick; for (int i = 0; i < _parties.Length; i++) { _parties[i].DestroyIt(); } _fakeServer = null; _turnOrders = null; _battleLogic = null; _currentActiveSpells = null; _currentSlcCharacter = null; _currentActionsStack = null; _externalLogic.DestroyIt(); _externalLogic = null; _parties[0] = null; _parties[1] = null; _parties = null; }
private void SetExternalLogic() { switch (_type) { case BattleControllerType.Tutorial_MiniBoss: _externalLogic = new BtlCtrlExternalLogic_TutMiniBoss(); break; case BattleControllerType.Tutorial_Zahak: _externalLogic = new BtlCtrlExternalLogic_TutZahak(); break; } _externalLogic.Init(this); }
//Public Methods public void Init(List <BtlCtrlCharacter> playerCharacters, List <BtlCtrlCharacter> aiCharacters, string playerName, string aiName, List <long> turns, BattleControllerType type, int turnTime = 0, BattleSceneType sceneType = BattleSceneType.Tutorial_Hell) { _parties = new BtlCtrlParty[2]; _parties[0] = new BtlCtrlParty(); _parties[0].Init(playerCharacters, TeamTypes.Player, playerName); _parties[1] = new BtlCtrlParty(); _parties[1].Init(aiCharacters, TeamTypes.Enemy, aiName); ListenToPartiesAndCharactersEvents(); _turnOrders = turns; _turnTime = turnTime; _type = type; _sceneType = sceneType; _currentState = States.WaitToStartFight; _currentTurnIndex = -1; _currentActionsStack = new Stack <ActionData>(); _currentActiveSpells = new List <BtlCtrlSpell>(); _externalLogic = null; SetExternalLogic(); _secretController = new BtlCtrlSecretController(); _secretController.Event_ActionGenerated += OnActionGenerated; _fakeServer = FakeServer.instance; _fakeServer.Event_OnMove += OnMove; _fakeServer.Event_OnReadyCome += OnReadyCome; }