protected override void OnStart() { base.OnStart(); sceneIns = GetComponentInParent <SceneTotalPoints>(); thisCs.OnBeAttack += (CharacterState cs) => ChangeTarget(cs); sceneIns.Tower.OnBeAttack += (CharacterState tCs) => TowerBeAttack(tCs); }
public override void InitScene() { sceneType = SceneType.TP; instance = this; ReadTask(); SpawnMonster[] sm = GetComponentsInChildren <SpawnMonster>(); for (int i = 0; i < sm.Length; i++) { spwanList.Add(sm[i]); } Tower.OnBorn += AddCallbacks; Tower.OnDead += (CharacterState mCs) => { WinCondition(blueSumRatio > redSumRatio ? true : false && blueSumRatio != redSumRatio); SceneUIManager.instance.pnReborn.HideRevornCD(); }; MobaMiniMap.instance.AddMapIconByType(Tower); MonsterData towerData = new MonsterData(206000200, (int)Towerlvl); towerData.groupIndex = 2; towerData.lvlRate = Towerlvl; towerData.state = Modestatus.Tower; Tower.InitData(towerData); Tower.GetComponent <Tower_AI>().InitTowerAI(); AddCs(Tower); spawn = GetComponentsInChildren <SpawnMonster>(); for (int i = 0; i < spawn.Length; i++) { spawn[i].OnCreatMonster += OnMonsterCreated; } CreateMainHero(); MobaMiniMap.instance.AddMapIconByType(player); escortNPC = player; player.AddHpBar(); CreateEnemyHero(); player.OnDead += (CharacterState mCs) => OnHeroDead(mCs); //SceneNode sceneNode = FSDataNodeTable<SceneNode>.GetSingleton().FindDataByType(GameLibrary.dungeonId); //BattleCDandScore.instance.StartCD(null != sceneNode && sceneNode.time_limit != 0 ? (int)sceneNode.time_limit : 300); //BattleCDandScore.instance.cd.OnRemove += (int count, long id) => //{ // if (blueSumRatio > redSumRatio) // WinCondition(true); // else // WinCondition(false); //}; base.InitScene(); }