override public BT_Status UpdateAction() { timer_spawning += Time.deltaTime; timer_spawning_other_enemy += Time.deltaTime; if (timer_spawning < total_time_spawning) { if (timer_spawning_other_enemy > time_to_spawn_next_enemy) { timer_spawning_other_enemy = 0; Vector2 point_to_spawn = transform.position + Random.insideUnitSphere * radius; GameObject temp_go = Instantiate(melee_enemy); if (myBT.enemy_type == Enemy_type.MACLIR_ENEMY) { Banshee_Blackboard soldierBt = temp_go.GetComponent <Banshee_Blackboard>(); soldierBt.playerIsInsideRoom.SetValue(true); } else { Soldier_Blackboard soldierBt = temp_go.GetComponent <Soldier_Blackboard>(); soldierBt.playerIsInsideRoom.SetValue(true); } temp_go.SetActive(true); temp_go.transform.position = point_to_spawn; } } else { isFinish = true; collider_enemy.enabled = true; ImortalGO.SetActive(false); } return(BT_Status.RUNNING); }
private void React_To_Slash() { //Debug.Log("Enemies detected: " + enemies_found.Length); cam_manager.Cam_Shake(); foreach (Collider2D col in enemies_found) { Transform parent = col.transform.parent; if (parent != null) { //Detect enemy type BT_Soldier soldier = parent.GetComponent <BT_Soldier>(); if (soldier != null) { if (soldier.currentAction != null) { soldier.currentAction.isFinish = true; } soldier.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); Soldier_Blackboard bb_soldier = parent.GetComponent <Soldier_Blackboard>(); bb_soldier.is_enemy_hit.SetValue(true); } BT_Caorthannach Caorth = parent.GetComponent <BT_Caorthannach>(); if (Caorth != null) { if (Caorth.currentAction != null) { Caorth.currentAction.isFinish = true; } Caorth.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); Caorthannach_Blackboard bb_caorth = parent.GetComponent <Caorthannach_Blackboard>(); bb_caorth.is_enemy_hit.SetValue(true); } BT_Kelpi Kelpi = parent.GetComponent <BT_Kelpi>(); if (Kelpi != null) { /*if (Kelpi.currentAction != null) * { * Kelpi.currentAction.isFinish = true; * }*/ Kelpi.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); Kelpi_Blackboard bb_kelpi = parent.GetComponent <Kelpi_Blackboard>(); bb_kelpi.is_enemy_hit.SetValue(true); } BT_MacLir Maclir = parent.GetComponent <BT_MacLir>(); if (Maclir != null) { if (Maclir.currentAction != null) { Maclir.currentAction.isFinish = true; } Maclir.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); MacLir_Blackboard bb_maclir = parent.GetComponent <MacLir_Blackboard>(); bb_maclir.is_enemy_hit.SetValue(true); } BT_DearDug DearDug = parent.GetComponent <BT_DearDug>(); if (DearDug != null) { if (DearDug.currentAction != null) { DearDug.currentAction.isFinish = true; } DearDug.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); DearDug_Blackboard dearDugBB = parent.GetComponent <DearDug_Blackboard>(); dearDugBB.is_enemy_hit.SetValue(true); } BT_Banshee Banshee = parent.GetComponent <BT_Banshee>(); if (Banshee != null) { if (Banshee.currentAction != null) { Banshee.currentAction.isFinish = true; } Banshee_Blackboard bansheeBB = parent.GetComponent <Banshee_Blackboard>(); if (Banshee.myState == BT_Banshee.BansheeState.STUNNED_BANSHEE) { Banshee.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); bansheeBB.is_enemy_hit.SetValue(true); } else { bansheeBB.want_to_hit.SetValue(true); } } BT_Dagda Dagda = parent.GetComponent <BT_Dagda>(); if (Dagda != null) { if (Dagda.currentAction != null) { Dagda.currentAction.isFinish = true; } Dagda_Blackboard dagdaBB = parent.GetComponent <Dagda_Blackboard>(); Dagda.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); dagdaBB.is_enemy_hit.SetValue(true); } BT_Dullahan Dullahan = parent.GetComponent <BT_Dullahan>(); if (Dullahan != null) { if (Dullahan.currentAction != null) { Dullahan.currentAction.isFinish = true; } Dullahan_Blackboard dullahanBB = parent.GetComponent <Dullahan_Blackboard>(); Dullahan.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); dullahanBB.is_enemy_hit.SetValue(true); } BT_Morrigan Morrigan = parent.GetComponent <BT_Morrigan>(); if (Morrigan != null) { if (Morrigan.currentAction != null) { Morrigan.currentAction.isFinish = true; } Morrigan_Blackboard morriganBB = parent.GetComponent <Morrigan_Blackboard>(); Morrigan.Enemy_Live_Modification(-player_stats.Right_Hand_Object.damage); morriganBB.is_enemy_hit.SetValue(true); } } else { Debug.Log("Parent null _Slash_Attack"); } } System.Array.Clear(enemies_found, 0, enemies_found.Length); //Call enemy damage function }