// 更新 public override void Update() { // 更新目前的關卡 m_NowStageHandler.Update(); // 是否要切換下一個關卡 if (m_PBDGame.GetEnemyCount() == 0) { // 是否结束 if (m_NowStageHandler.IsFinished() == false) { return; } // 取得下一關 IStageHandler NewStageData = m_NowStageHandler.CheckStage(); // 是否為舊的關卡 if (m_NowStageHandler == NewStageData) { m_NowStageHandler.Reset(); } else { m_NowStageHandler = NewStageData; } // 通知進入下一關 NotiyfNewStage(); } }
// 更新 public override void Update() { // 更新目前的關卡 m_NowStageHandler.Update(); // 是否要切換下一個關卡 if(m_PBDGame.GetEnemyCount() == 0 ) { // 是否結束 if( m_NowStageHandler.IsFinished()==false) return ; // 取得下一關 IStageHandler NewStageData = m_NowStageHandler.CheckStage(); // 是否為舊的關卡 if( m_NowStageHandler == NewStageData) m_NowStageHandler.Reset(); else m_NowStageHandler = NewStageData; // 通知進入下一關 NotiyfNewStage(); } }
private void InitStageChain() { int lv = 1; NormalStageHandler handler1 = new NormalStageHandler(this, lv++, 3, EnemyType.Elf, WeaponType.Gun, 1, GetRandomPos()); NormalStageHandler handler2 = new NormalStageHandler(this, lv++, 6, EnemyType.Elf, WeaponType.Rifle, 3, GetRandomPos()); NormalStageHandler handler3 = new NormalStageHandler(this, lv++, 9, EnemyType.Elf, WeaponType.Rocket, 3, GetRandomPos()); NormalStageHandler handler4 = new NormalStageHandler(this, lv++, 13, EnemyType.Ogre, WeaponType.Gun, 4, GetRandomPos()); NormalStageHandler handler5 = new NormalStageHandler(this, lv++, 17, EnemyType.Ogre, WeaponType.Rifle, 4, GetRandomPos()); NormalStageHandler handler6 = new NormalStageHandler(this, lv++, 21, EnemyType.Ogre, WeaponType.Rocket, 4, GetRandomPos()); NormalStageHandler handler7 = new NormalStageHandler(this, lv++, 26, EnemyType.Troll, WeaponType.Gun, 5, GetRandomPos()); NormalStageHandler handler8 = new NormalStageHandler(this, lv++, 31, EnemyType.Troll, WeaponType.Rocket, 5, GetRandomPos()); NormalStageHandler handler9 = new NormalStageHandler(this, lv++, 36, EnemyType.Troll, WeaponType.Rocket, 5, GetRandomPos()); handler1.SetNextHandler(handler2) .SetNextHandler(handler3) .SetNextHandler(handler4) .SetNextHandler(handler5) .SetNextHandler(handler6) .SetNextHandler(handler7) .SetNextHandler(handler8) .SetNextHandler(handler9); m_RootHandler = handler1; }
public override void Update() { m_NowStageHandler.Update(); if (BattleManager.Instance.GetEnemyCount() == 0) { if (m_NowStageHandler.IsFinished() == false) { return; } level++; if (level < 3) { IStageHandler NewStageData = m_NowStageHandler.CheckStage(); if (m_NowStageHandler == NewStageData) { m_NowStageHandler.Reset(); } else { m_NowStageHandler = NewStageData; } Debug.Log("当前通关波次:" + level); return; } NotiyfNewStage(); } }
/// <summary> /// 通过传过来的关卡初始化(单个) /// </summary> /// <param name="info"></param> public void InitStage(StageInfo info) { /***********建议读表i***********/ if (m_RootStageHandler != null) { return; } NormalStageData StageData = null; // 生成的怪物的Enemy IStageScore StageScore = null; // 通关的成绩 IStageHandler NewStage = null; ////1 StageData = new NormalStageData(1, GetSpawnPosition()); StageData.AddStageData(ENUM_Enemy.Keraha, 1); StageScore = new StageScoreEnemyKilledCount(1, this); NewStage = new NormalStageHandler(StageScore, StageData); // 设置初始关卡 m_RootStageHandler = NewStage; //指定第一个关卡 m_NowStageHandler = m_RootStageHandler; level = 0; }
// public override void Initialize() { // 設定關卡 InitializeStageData(); // 指定第一個關卡 m_NowStageHandler = m_RootStageHandler; m_NowStageLv = 1; // 註冊遊戲事件 m_PBDGame.RegisterGameEvent( ENUM_GameEvent.EnemyKilled, new EnemyKilledObserverStageScore(this)); }
// public override void Initialize() { // 設定關卡 InitializeStageData(); // 指定第一個關卡 m_NowStageHandler = m_RootStageHandler; m_NowStageLv = 1; // 註冊遊戲事件 m_PBDGame.RegisterGameEvent(ENUM_GameEvent.EnemyKilled, new EnemyKilledObserverStageScore(this)); }
/// <summary> /// 初始化通关条件 /// </summary> private void CreateStateHandler() { mIsPause = true; if (mSceneID == 1) { mIsPause = false; mRootHandler = new SelectStageHandler(this, 0); return; } int lv = 0; LevelPO levelPO = LevelData.Instance.GetLevelPO(mSceneID * 100 + Define.GAME_CONFIG_DIFFICULTY); if (levelPO == null) { return; } List <IStageHandler> list = new List <IStageHandler>(); switch (mSceneID) { case 2: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new TownStageHandler(this, lv++); list.Add(handle); } break; case 4: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new BullDemonKingStageHandler(this, lv++); list.Add(handle); } break; case 5: for (int i = 0; i < levelPO.CheckPointScores.Length; ++i) { IStageHandler handle = new FarmStageHandler(this, lv++); list.Add(handle); } break; case 6: break; } for (int i = 0; i < list.Count - 1; ++i) { list[i].SetNextHandler(list[i + 1]); } mRootHandler = list[0]; }
public override void OnInit() { spawnPosList = new List <Vector3>(); OnInitSpawnPosList(); OnInitStageChain(); NowLv = 1; nowHandler = GetHandlerByLV(NowLv); GameFacade.Instance.RegisterObserver(GameEventType.EnemyKilled , new EnemyyKilledObserverStageSystem(this)); }
public IStageHandler GetHandlerByLV(int _nowLv) { IStageHandler _nowHandler = null; if (stageHandlerDic.TryGetValue(_nowLv, out _nowHandler)) { return(_nowHandler); } else { Debug.Log("GetHandlerByLV is null"); return(null); } }
public override void OnUpdate() { if (nowHandler != null) { if (!nowHandler.CheckIsFinised()) { nowHandler.UpdateStage(); } else { GameFacade.Instance.TriggerEvent(GameEventType.NewStage); NowLv++; nowHandler = GetHandlerByLV(NowLv); } } }
private void InitStageChain() { int lv = 1; NormalStageHandler hanlder1 = new NormalStageHandler(lv++, EnemyType.Elf, WeaponType.Gun, 4, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder2 = new NormalStageHandler(lv++, EnemyType.Elf, WeaponType.Rifle, 8, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder3 = new NormalStageHandler(lv++, EnemyType.Elf, WeaponType.Rocket, 16, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder4 = new NormalStageHandler(lv++, EnemyType.Ogre, WeaponType.Gun, 32, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder5 = new NormalStageHandler(lv++, EnemyType.Ogre, WeaponType.Rifle, 4, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder6 = new NormalStageHandler(lv++, EnemyType.Ogre, WeaponType.Rocket, 4, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder7 = new NormalStageHandler(lv++, EnemyType.Troll, WeaponType.Gun, 5, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder8 = new NormalStageHandler(lv++, EnemyType.Troll, WeaponType.Rifle, 5, GetRandomPos(), lv * 2, this); NormalStageHandler hanlder9 = new NormalStageHandler(lv++, EnemyType.Troll, WeaponType.Rocket, 5, GetRandomPos(), lv * 2, this); hanlder1.SetNextHandler(hanlder2).SetNextHandler(hanlder3).SetNextHandler(hanlder4) .SetNextHandler(hanlder5).SetNextHandler(hanlder6).SetNextHandler(hanlder7) .SetNextHandler(hanlder8).SetNextHandler(hanlder9); mRootHandler = hanlder1; }
/// <summary> /// 通过传过来的关卡初始化(列表) /// </summary> /// <param name="info"></param> public void InitStage(List <StageInfo> infos) { #region /***********建议读表i***********/ if (m_RootStageHandler != null) { return; } NormalStageData StageData = null; // 生成的怪物的Enemy IStageScore StageScore = null; // 通关的成绩 IStageHandler NewStage = null; ////1 StageData = new NormalStageData(1, GetSpawnPosition()); StageData.AddStageData(ENUM_Enemy.Keraha, 1); StageScore = new StageScoreEnemyKilledCount(1, this); NewStage = new NormalStageHandler(StageScore, StageData); // 设置初始关卡 m_RootStageHandler = NewStage; ////2 //StageData = new NormalStageData(2, GetSpawnPosition(), AttackPosition); //StageData.AddStageData(ENUM_Enemy.Keraha, 3); //StageScore = new StageScoreEnemyKilledCount(6, this); //NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); ////3 //StageData = new NormalStageData(3, GetSpawnPosition(), AttackPosition); //StageData.AddStageData(ENUM_Enemy.Keraha, 3); //StageScore = new StageScoreEnemyKilledCount(9, this); //NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); #endregion }
private void InitStageChain() { int lv = 1; NormalStageHandler handler1 = new NormalStageHandler(this, lv++, 3, EnemyType.Elf, WeaponType.Gun, 3, GetRandomPos()); NormalStageHandler handler2 = new NormalStageHandler(this, lv++, 6, EnemyType.Elf, WeaponType.Rifle, 3, GetRandomPos()); NormalStageHandler handler3 = new NormalStageHandler(this, lv++, 9, EnemyType.Elf, WeaponType.Rocket, 3, GetRandomPos()); NormalStageHandler handler4 = new NormalStageHandler(this, lv++, 14, EnemyType.Ogre, WeaponType.Gun, 4, GetRandomPos()); NormalStageHandler handler5 = new NormalStageHandler(this, lv++, 18, EnemyType.Ogre, WeaponType.Rifle, 4, GetRandomPos()); NormalStageHandler handler6 = new NormalStageHandler(this, lv++, 22, EnemyType.Ogre, WeaponType.Rocket, 4, GetRandomPos()); NormalStageHandler handler7 = new NormalStageHandler(this, lv++, 27, EnemyType.Troll, WeaponType.Gun, 5, GetRandomPos()); NormalStageHandler handler8 = new NormalStageHandler(this, lv++, 32, EnemyType.Troll, WeaponType.Rifle, 5, GetRandomPos()); NormalStageHandler handler9 = new NormalStageHandler(this, lv++, 37, EnemyType.Troll, WeaponType.Rocket, 5, GetRandomPos()); handler1.nextHandler = handler2; handler2.nextHandler = handler3; handler3.nextHandler = handler4; handler4.nextHandler = handler5; handler5.nextHandler = handler6; handler6.nextHandler = handler7; handler7.nextHandler = handler8; handler8.nextHandler = handler9; mRootHandler = handler1; }
// 初始所有關卡 private void InitializeStageData() { if( m_RootStageHandler!=null) return ; // 參考點 Vector3 AttackPosition = GetAttackPosition(); NormalStageData StageData = null; // 關卡要產生的Enemy IStageScore StageScore = null; // 關卡過關資訊 IStageHandler NewStage = null; // 第1關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition ); StageData.AddStageData( ENUM_Enemy.Elf, ENUM_Weapon.Gun, 3); StageScore = new StageScoreEnemyKilledCount(3, this); NewStage = new NormalStageHandler(StageScore, StageData ); // 設定為起始關卡 m_RootStageHandler = NewStage; // 第2關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Elf, ENUM_Weapon.Rifle,3); StageScore = new StageScoreEnemyKilledCount(6, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第3關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Elf, ENUM_Weapon.Rocket,3); StageScore = new StageScoreEnemyKilledCount(9, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第4關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Troll, ENUM_Weapon.Gun,3); StageScore = new StageScoreEnemyKilledCount(12, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第5關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Troll, ENUM_Weapon.Rifle,3); StageScore = new StageScoreEnemyKilledCount(15, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第5關:Boss關卡 /*StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Rocket,3); StageScore = new StageScoreEnemyKilledCount(13, this); NewStage = NewStage.SetNextHandler( new BossStageHandler( StageScore, StageData) );*/ // 第6關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Troll, ENUM_Weapon.Rocket,3); StageScore = new StageScoreEnemyKilledCount(18, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第7關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Gun,3); StageScore = new StageScoreEnemyKilledCount(21, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第8關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Rifle,3); StageScore = new StageScoreEnemyKilledCount(24, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第9關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Rocket,3); StageScore = new StageScoreEnemyKilledCount(27, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); // 第10關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData( ENUM_Enemy.Elf, ENUM_Weapon.Rocket,3); StageData.AddStageData( ENUM_Enemy.Troll, ENUM_Weapon.Rocket,3); StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Rocket,3); StageScore = new StageScoreEnemyKilledCount(30, this); NewStage = NewStage.SetNextHandler( new NormalStageHandler( StageScore, StageData) ); }
// 初始所有關卡 private void InitializeStageData() { if (m_RootStageHandler != null) { return; } // 參考點 Vector3 AttackPosition = GetAttackPosition(); NormalStageData StageData = null; // 關卡要產生的Enemy IStageScore StageScore = null; // 關卡過關資訊 IStageHandler NewStage = null; // 第1關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Elf, ENUM_Weapon.Gun, 3); StageScore = new StageScoreEnemyKilledCount(3, this); NewStage = new NormalStageHandler(StageScore, StageData); // 設定為起始關卡 m_RootStageHandler = NewStage; // 第2關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Elf, ENUM_Weapon.Rifle, 3); StageScore = new StageScoreEnemyKilledCount(6, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第3關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Elf, ENUM_Weapon.Rocket, 3); StageScore = new StageScoreEnemyKilledCount(9, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第4關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Troll, ENUM_Weapon.Gun, 3); StageScore = new StageScoreEnemyKilledCount(12, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第5關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Troll, ENUM_Weapon.Rifle, 3); StageScore = new StageScoreEnemyKilledCount(15, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第5關:Boss關卡 /*StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); * StageData.AddStageData( ENUM_Enemy.Ogre, ENUM_Weapon.Rocket,3); * StageScore = new StageScoreEnemyKilledCount(13, this); * NewStage = NewStage.SetNextHandler( new BossStageHandler( StageScore, StageData) );*/ // 第6關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Troll, ENUM_Weapon.Rocket, 3); StageScore = new StageScoreEnemyKilledCount(18, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第7關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Ogre, ENUM_Weapon.Gun, 3); StageScore = new StageScoreEnemyKilledCount(21, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第8關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Ogre, ENUM_Weapon.Rifle, 3); StageScore = new StageScoreEnemyKilledCount(24, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第9關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Ogre, ENUM_Weapon.Rocket, 3); StageScore = new StageScoreEnemyKilledCount(27, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); // 第10關 StageData = new NormalStageData(3f, GetSpawnPosition(), AttackPosition); StageData.AddStageData(ENUM_Enemy.Elf, ENUM_Weapon.Rocket, 3); StageData.AddStageData(ENUM_Enemy.Troll, ENUM_Weapon.Rocket, 3); StageData.AddStageData(ENUM_Enemy.Ogre, ENUM_Weapon.Rocket, 3); StageScore = new StageScoreEnemyKilledCount(30, this); NewStage = NewStage.SetNextHandler(new NormalStageHandler(StageScore, StageData)); }
private void AddDic(IStageHandler ish) { stageHandlerDic.Add(ish.lv, ish); }
protected IStageScore m_StageScore = null;// 關卡的分數 // 設定下一個關卡 public IStageHandler SetNextHandler(IStageHandler NextHandler) { m_NextHandler = NextHandler; return m_NextHandler; }
public IStageHandler SetNextHandler(IStageHandler handler) { mNextHandler = handler; return(mNextHandler); }
/// <summary> /// 设置下一个关卡 /// </summary> /// <param name="NextHandler"></param> /// <returns></returns> public IStageHandler SetNextHandler(IStageHandler NextHandler) { m_NextHandler = NextHandler; return(m_NextHandler); }
public IStageHandler SetNexHandler(IStageHandler nextStageHandler) { m_NextHandler = nextStageHandler; return(m_NextHandler); }