IEnumerator InvokeCrows() { float theta = 0f; float deltTheta = (2f * Mathf.PI) / numCrows; GameObject[] crowsGo = new GameObject[numCrows]; // Vector3 old_pos = Vector3.zero; for (int i = 0; i < numCrows; i++) { Vector3 pos = new Vector3(radius * Mathf.Cos(theta), radius * Mathf.Sin(theta), 0f); crowsGo[i] = Instantiate(crowPrefab); Vector3 tempPos = transform.position + pos; crowsGo[i].transform.position = new Vector3(tempPos.x, tempPos.y + 0.75f, 0f); theta += deltTheta; SpriteRenderer mySprite = crowsGo[i].GetComponentInChildren <SpriteRenderer>(); yield return(mySprite.DOFade(1.0f, fadeDuration).WaitForCompletion()); yield return(new WaitForSeconds(0.15f)); } yield return(new WaitForSeconds(1.0f)); for (int i = 0; i < numCrows; i++) { BT_Soldier crow = crowsGo[i].GetComponentInChildren <BT_Soldier>(); crow.crowCanGo = true; BoxCollider2D myCol = crowsGo[i].transform.GetChild(1).GetComponent <BoxCollider2D>(); myCol.enabled = true; yield return(new WaitForSeconds(0.35f)); } yield return(new WaitForSeconds(0.5f)); myHitCollider.enabled = true; inmortalGO.SetActive(false); //Throw bat transformation anim if (myAnimator) { myAnimator.SetBool("Chasing", true); } // isFinish = true; myBT.myBB.SetParameter("invokedCrows", true); }
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 }