private IEnumerator Revenge(float delayTime, int num) { if (stageChallange.ChallangeStart && !stageChallange.IsPass) { for (int i = 0; i < num; i++) { int creatnum = Random.Range(0, CreatPos.Length); Vector3 P = CreatPos[creatnum].position; BeeMonsterStateController enemyai = new BeeMonsterStateController(); aIGameManger.CreatGroupRoleRevenge(enemyai, "Enemy/" + "BeeM", P, Quaternion.identity, this); enemyai.targetPos.transform.position = Tower.transform.position; } } yield return(new WaitForSeconds(delayTime)); yield return(new WaitForSeconds(delayTime)); for (int i = 0; i < beeMonsterStateControllers.Count; i++) { if (beeMonsterStateControllers[i].IsEnable) { //beeMonsterStateControllers[i].p_health.currenthp -= 999; //beeMonsterStateControllers[i].targetPos.transform.position = Tower.transform.position; beeMonsterStateControllers[i].m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; beeMonsterStateControllers[i].House = null; beeMonsterStateControllers[i].targetPos.transform.position = Tower.transform.position; } } yield return(new WaitForSeconds(delayTime / 2)); }
public virtual void DesPatch() { CurrentBeeNum -= 1; //Vector3 P = new Vector3(Random.Range(-5, 5), 0, Random.Range(-5, 5)) + Role.transform.position + Role.transform.forward * 5; int creatnum = Random.Range(0, CreatPos.Length); Vector3 P = CreatPos[creatnum].position; BeeMonsterStateController enemyai = new BeeMonsterStateController(); aIGameManger.CreatGroupRole(enemyai, "Enemy/" + "BeeM", P, Quaternion.identity, this); }
public void CreatGroupRole(BeeMonsterStateController ai, string msg, Vector3 P, Quaternion Q, GroupEnemyAIStateController _House) { //Debug.Log("StartCreatModel"); ai.msg = msg; //Debug.Log(msg); GameObject go = Resources.Load <GameObject>(msg); ai.Role = Instantiate(go, P, Q); //ai.Role.transform.position = P; //ai.Role.transform.rotation = Q; ai.Role.GetComponent <PlayerHealth>().stateController = ai;// ai.Intialize(this); ai.House = _House; _House.beeMonsterStateControllers.Add(ai); enemyaiStateControllers.Add(ai); //Debug.Log("Finish"); }
public virtual void DefendDesPatch(GameObject target) { int nums = Random.Range(2, 4); if (CurrentBeeNum >= nums) { CurrentBeeNum -= nums; for (int i = 0; i < nums; i++) { //Vector3 P = new Vector3(Random.Range(-5, 5), 0, Random.Range(-5, 5)) + Role.transform.position + Role.transform.forward * 5; int creatnum = Random.Range(0, CreatPos.Length); Vector3 P = CreatPos[creatnum].position; BeeMonsterStateController enemyai = new BeeMonsterStateController(); aIGameManger.CreatGroupRole(enemyai, "Enemy/" + "BeeM", P, Quaternion.identity, this, target); } } else { Debug.Log("NotEnough Bee"); } }
void CreatMonster() { //if(teach.Instance.FirstMonster == false) //{ // teach.Instance.TeachLevel = 153; //} Vector3 ChallangePos = this.transform.position; GameObject go = Resources.Load <GameObject>("Syringe"); PlayerHealth health; if (go.GetComponent <PlayerHealth>() != null) { health = go.GetComponent <PlayerHealth>(); } else { health = go.AddComponent <PlayerHealth>(); } health.IsStageChallange = true; health.hp = 100; Syringe = GameObject.Instantiate(go, ChallangePos + new Vector3(0, 10, 0), Quaternion.identity); medicine = Syringe.transform.GetChild(3).gameObject; switch (monsterType[currentChallange]) { case "Easy": { for (int i = 0; i < monsterNum[currentChallange]; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); EnemyAIStateController ai = new LittleMonsterStateController(); aIGameManger.AutoCreatEnemyRole(ai, "Enemy/" + "NS", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; } } break; case "Normal": { for (int i = 0; i < monsterNum[currentChallange]; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); CombineEnemyAIStateController ai = new CombineMonsterStateController(); aIGameManger.AutoCreatCombineRole(ai, "Enemy/" + "CB", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = CombineEnemyAIStateController.CombineEnemyState.DEFEND; } } break; case "Mix1": { int halfnum = monsterNum[currentChallange] / 2; for (int i = 0; i < halfnum; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); EnemyAIStateController ai = new BeeMonsterStateController(); aIGameManger.AutoCreatEnemyRole(ai, "Enemy/" + "BeeM", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; } for (int i = halfnum; i < monsterNum[currentChallange]; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); EnemyAIStateController ai = new LittleMonsterStateController(); aIGameManger.AutoCreatEnemyRole(ai, "Enemy/" + "NS", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; } } break; case "Mix2": { int thirdnum = monsterNum[currentChallange] / 3; for (int i = 0; i < thirdnum; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); EnemyAIStateController ai = new BeeMonsterStateController(); aIGameManger.AutoCreatEnemyRole(ai, "Enemy/" + "BeeM", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; } for (int i = thirdnum; i < 2 * thirdnum; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); EnemyAIStateController ai = new LittleMonsterStateController(); aIGameManger.AutoCreatEnemyRole(ai, "Enemy/" + "NS", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = EnemyAIStateController.EnemyAIState.DEFEND; } for (int i = 2 - thirdnum; i < monsterNum[currentChallange]; i++) { Vector3 creatpos = creatCenter[currentChallange] + new Vector3(Random.Range(-20, 20), .2f, Random.Range(-20, 20)); Quaternion spawnRotation = new Quaternion(); spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f)); CombineEnemyAIStateController ai = new CombineMonsterStateController(); aIGameManger.AutoCreatCombineRole(ai, "Enemy/" + "CB", creatpos, spawnRotation); Vector3 challangepos = GameObject.FindObjectOfType <StageChallange>().transform.position; challangepos.y = 0; ai.targetPos.transform.position = challangepos; ai.m_aiState = CombineEnemyAIStateController.CombineEnemyState.DEFEND; } } break; case "Mix3": { } break; case "Hard": { } break; default: break; } currentChallange += 1; if (currentChallange < totalChallange) { currentChallangeTime = challangeWaitTime[currentChallange]; ShowTimeDiscount(currentChallangeTime); } }
public void RemoveFromHouse(BeeMonsterStateController bee) { beeMonsterStateControllers.Remove(bee); }