protected override void OnBeginSkill() { if (Main.instance.GetRoom() != null) { mySensor = Main.instance.GetRoom()._sensor; mySensor.AddCallback_OnTriggerExit(ExitTheRoom); myEnemies = Main.instance.GetRoom().GetMyEnemies(); if (!Main.instance.GetRoom().VIPInRoom()) { int index = Random.Range(0, myEnemies.Count); myEnemies[index].IsTarget(); enemyVIP = myEnemies[index]; for (int i = 0; i < myEnemies.Count; i++) { myEnemies[i].Resume(); myEnemies[i].IAInitialize(Main.instance.GetCombatDirector()); if (i != index) { myEnemies[i].IsNormal(); } } } } else { NoRoom(); } }
void Start() { _sensor = GetComponentInChildren <SensorForEnemysInRoom>(); _sensor.AddCallback_OnTriggerEnter(EnterTheRoom); _sensor.AddCallback_OnTriggerExit(ExitRoom); Main.instance.SetRoom(this); myEnemies = new List <EnemyBase>(); var enemysInChilderen = GetComponentsInChildren <EnemyBase>(); foreach (var item in enemysInChilderen) { var enemys = item.GetComponent <EnemyBase>(); if (enemys) { myEnemies.Add(enemys); } } _sensor.myContent.SetActive(false); }