// [SerializeField] bool isAutoPlayEnabled; private void Awake() { int gameStatusCount = FindObjectsOfType <GameStatus>().Length; player = FindObjectOfType <Player>(); oppPlayer = FindObjectOfType <OppPlayer>(); if (gameStatusCount > 1) { Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); } }
public void Clear() { //Game.UI.CloseForm<UIBattleForm>(); RemoveMessage(); OppPlayer.StopAI(); MonsterId = 0; uiActions.Clear(); MyPlayer.Data.BuffList.Clear(); MyPlayer = null; OppPlayer = null; dicRoundCounter = null; dicBattleCounter = null; RewardData = null; State = BattleState.None; lastState = BattleState.None; }
void OnEnterState() { switch (State) { case BattleState.Loading: break; case BattleState.Ready: break; case BattleState.MyRoundStart: //MyPlayer.Data.AP = MyPlayer.Data.MaxAP = MyPlayer.Data.MaxAP + 1; RoundCount++; State++; break; case BattleState.MyDrawCard: //ApplyPlayerBuffs(MyPlayer, 1); MyPlayer.ApplyTimeEffects(BattleActionTime.RoundStart); //DrawCard(MyPlayer.Data, 3); MyPlayer.ApplyAction(BattleActionType.DrawCard, 3); State++; break; case BattleState.MyRound: CanUseCard = true; break; case BattleState.MyUsingCard: break; case BattleState.MyRoundEnd: CanUseCard = false; //ApplyPlayerBuffs(MyPlayer, 2); MyPlayer.ApplyTimeEffects(BattleActionTime.RoundEnd); State++; break; case BattleState.OppRoundStart: //OppPlayer.Data.AP = OppPlayer.Data.MaxAP = OppPlayer.Data.MaxAP + 1; State++; break; case BattleState.OppDrawCard: //ApplyPlayerBuffs(OppPlayer, 1); //DrawCard(OppPlayer.Data, 3); OppPlayer.ApplyTimeEffects(BattleActionTime.RoundStart); OppPlayer.ApplyAction(BattleActionType.DrawCard, 3); State++; break; case BattleState.OppRound: //开启AI OppPlayer.UpdateAI(); break; case BattleState.OppUsingCard: State++; break; case BattleState.OppRoundEnd: //ApplyPlayerBuffs(OppPlayer, 2); OppPlayer.ApplyTimeEffects(BattleActionTime.RoundEnd); State = BattleState.MyRoundStart; break; case BattleState.BattleEnd_MyEscape: MyPlayer.Data.HP = 1; SaveData(2); break; case BattleState.BattleEnd_OppEscape: SaveData(3); break; case BattleState.BattleEnd_Win: SaveData(0); break; case BattleState.BattleEnd_Lose: //battleForm.LoseBattle(); SaveData(1); break; default: break; } }