public void MonGenerateP2P(int tblID, int typeID, int seq, float x, float y, float z, float vx, float vy, float vz) { if (MyInfoManager.Instance.Status == 4 && !dicDescriptor.ContainsKey(seq)) { monGenID = seq; checkBossP2P(monGenID, tblID); int hP = DefenseManager.Instance.GetMonTable(tblID).HP; int dp = DefenseManager.Instance.GetMonTable(tblID).Dp; Vector3 startPosition = new Vector3(x, y, z); OnEnter(tblID, typeID, monGenID, hP, bP2P: true, dp); GameObject gameObject = Get(monGenID); if (gameObject != null) { MonAI aIClass = Instance.GetAIClass(gameObject, tblID); if (aIClass == null) { Debug.LogError("tblID error: " + tblID); } else { aIClass.StartPosition = startPosition; } } } }
public MonAI GetAIClass(GameObject m, int tblID) { MonAI result = null; switch (tblID) { case 0: result = m.GetComponent <aiBee>(); break; case 1: result = m.GetComponent <aiBee2>(); break; case 2: result = m.GetComponent <aiIntruder>(); break; case 3: result = m.GetComponent <aiBomber>(); break; case 4: result = m.GetComponent <aiChampion>(); break; default: Debug.LogError("GetAIClass Not Found: " + tblID); break; } return(result); }
private void Update() { if (!bSleep) { if (bDie) { deltaTime += Time.deltaTime; if (bImmediateBoom || deltaTime > timerBoomTimeMax) { if (bBigBoom) { Object.Instantiate((Object)MonManager.Instance.m_expFX4x, base.transform.position, Quaternion.Euler(0f, 0f, 0f)); } else { Object.Instantiate((Object)MonManager.Instance.m_expFX, base.transform.position, Quaternion.Euler(0f, 0f, 0f)); } if (monAI != null) { monAI.LastCommand(); } MonManager.Instance.Remove(monProperty.Desc.Seq); bSleep = true; } } else { deltaTime += Time.deltaTime; if (!bDie && monProperty.Desc.Xp <= 0) { bDie = true; bImmediateBoom = true; monAI = MonManager.Instance.GetAIClass(monProperty.Desc.Seq, monProperty.Desc.tblID); if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master) { if (monProperty.Desc.bRedTeam) { DefenseManager.Instance.BluePoint += monProperty.Desc.Dp; } else { DefenseManager.Instance.RedPoint += monProperty.Desc.Dp; } CSNetManager.Instance.Sock.SendCS_MISSION_POINT_REQ(DefenseManager.Instance.RedPoint, DefenseManager.Instance.BluePoint); } if (monProperty.Desc.tblID == 4) { MonManager.Instance.BossUnVisibleAll(monProperty.Desc.bRedTeam); } if (monAI == null) { Debug.LogError("{ MonController } monai == null: " + monProperty.Desc.tblID); } monAI.Die(); } } } }
public void AiReset() { foreach (KeyValuePair <int, GameObject> item in dicMon) { MonAI component = item.Value.GetComponent <MonAI>(); if (component != null) { component.ResetMove(); } else { Debug.LogError("ai == null"); } } }
public MonAI GetAIClass(int Seq, int tblID) { GameObject gameObject = Get(Seq); if (gameObject == null) { return(null); } MonAI result = null; switch (tblID) { case 0: result = gameObject.GetComponent <aiBee>(); break; case 1: result = gameObject.GetComponent <aiBee2>(); break; case 2: result = gameObject.GetComponent <aiIntruder>(); break; case 3: result = gameObject.GetComponent <aiBomber>(); break; case 4: result = gameObject.GetComponent <aiChampion>(); break; default: Debug.LogError("GetAIClass Not Found: " + tblID); break; } return(result); }
public GameObject AddMon(MonDesc desc) { SpawnerDesc spawner = BrickManager.Instance.GetSpawner(Brick.SPAWNER_TYPE.DEFENCE_SPAWNER, 0); if (spawner == null) { return(null); } Vector3 position = spawner.position; GameObject gameObject = null; if (desc.tblID == 0) { gameObject = (Object.Instantiate((Object)bee01, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject); } else if (desc.tblID == 1) { gameObject = (Object.Instantiate((Object)bee02, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject); } else if (desc.tblID == 2) { gameObject = (Object.Instantiate((Object)intruder01, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject); } else if (desc.tblID == 3) { gameObject = (Object.Instantiate((Object)bomber01, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject); } else if (desc.tblID == 4) { gameObject = (Object.Instantiate((Object)champ01, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject); } if (null == gameObject) { Debug.LogError("Fail to instantiate a monster: " + desc.tblID); return(null); } MonProperty component = gameObject.GetComponent <MonProperty>(); if (null == component) { Object.DestroyImmediate(gameObject); Debug.LogError("New monster doesnt have MonProperty: " + desc.tblID); return(null); } component.Desc = desc; component.Desc.coreToDmg = DefenseManager.Instance.GetMonTable(desc.tblID).toCoreDmg; component.Desc.InitLog(); component.InvisiblePosition = position; MonAI aIClass = Instance.GetAIClass(gameObject, desc.tblID); if (null == aIClass) { Object.DestroyImmediate(gameObject); Debug.LogError("New monster doesnt have monAI: " + desc.tblID); return(null); } aIClass.StartPosition = position; aIClass.moveSpeed = DefenseManager.Instance.GetMonTable(desc.typeID).MoveSpeed; aIClass.MonType = (MonAI.MON_TYPE)desc.typeID; dicMon.Add(desc.Seq, gameObject); aIClass.changeTexture(); if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master) { P2PManager instance = P2PManager.Instance; int tblID = desc.tblID; int typeID = desc.typeID; int seq = desc.Seq; float x = position.x; float y = position.y; float z = position.z; Vector3 forward = gameObject.transform.forward; float x2 = forward.x; Vector3 forward2 = gameObject.transform.forward; float y2 = forward2.y; Vector3 forward3 = gameObject.transform.forward; instance.SendPEER_MON_GEN(tblID, typeID, seq, x, y, z, x2, y2, forward3.z); } return(gameObject); }
public override void updateAreaHeal() { if (effCopy != null) { Transform transform = null; Transform[] componentsInChildren = GetComponentsInChildren <Transform>(); int num = 0; while (transform == null && num < componentsInChildren.Length) { if (componentsInChildren[num].name.Contains("Dummy_mon_effect")) { transform = componentsInChildren[num]; break; } num++; } effCopy.transform.position = transform.position; effCopy.transform.rotation = transform.rotation; } if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master) { dtHeal += Time.deltaTime; if (dtHeal > repeatTime) { P2PManager.Instance.SendPEER_DF_HEALER(monProp.Desc.Seq); Transform transform2 = null; Transform[] componentsInChildren2 = GetComponentsInChildren <Transform>(); int num2 = 0; while (transform2 == null && num2 < componentsInChildren2.Length) { if (componentsInChildren2[num2].name.Contains("Dummy_mon_effect")) { transform2 = componentsInChildren2[num2]; break; } num2++; } effCopy = (Object.Instantiate((Object)MonManager.Instance.healerEff, transform2.position, transform2.rotation) as GameObject); MonDesc[] array = MonManager.Instance.ToDescriptorArray(); for (int i = 0; i < array.Length; i++) { GameObject gameObject = MonManager.Instance.Get(array[i].Seq); float num3 = Vector3.Distance(base.transform.position, gameObject.transform.position); if (!(num3 > healRange)) { MonAI aIClass = MonManager.Instance.GetAIClass(gameObject, array[i].tblID); if (aIClass != null) { aIClass.ActiveHealEff(); } array[i].Xp += incHp; if (array[i].Xp > array[i].max_xp) { array[i].Xp = array[i].max_xp; } P2PManager.Instance.SendPEER_DF_SELFHEAL(array[i].Seq, array[i].Xp); } } dtHeal = 0f; } } }