public override void OnAddToWorld() { if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new GroupInteligentAI(this); } }
public override void OnAddToWorld() { if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new DefensiveAnimalAI(this); } }
void Start() { target = FindObjectOfType <PlayerHealth>().gameObject.transform; navMeshAgent = GetComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); if (isPatrolling) { patrolAI = GetComponent <PatrolAI>(); } }
public override void OnAddToWorld() { if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } }
public void SpawnPatrolAI(int playerID) { if (m_patrolAI == null) { m_patrolAI = PhotonNetwork.Instantiate("PatrolAIPhotonView", Vector3.zero, Quaternion.identity, 0); } if (m_patrolAI != null) { m_ai = m_patrolAI.GetComponentInChildren <PatrolAI>(); m_ai.Initialise(m_nodes, playerID); m_aiSpawned = true; } }
// Start is called before the first frame update void Start() { if (GetComponent <EnemyLOS>() != null) { los = GetComponent <EnemyLOS>(); } if (GetComponent <PatrolAI>() != null) { patrol = GetComponent <PatrolAI>(); } if (GetComponent <NavMeshAgent>() != null) { agent = GetComponent <NavMeshAgent>(); agent.speed = speed; } }
public MarshalMcBride() : base() { Name = "Marshal McBride"; Id = 197; Model = 1859; Level = RandomLevel(20); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 20 * Level; Block = 2 * Level; Flags1 = 0x08080066; NpcFlags = (int)NpcActions.Dialog; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; ResistShadow = 0; Str = (int)(Level / 1.5f); BaseHitPoints = 1250; BaseMana = 0; BoundingRadius = 1.7077550f; CombatReach = 1.500f; Speed = 3.1f; WalkSpeed = 3.1f; RunSpeed = 6.1f; Faction = Factions.Stormwind; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } NpcType = (int)NpcTypes.Humanoid; Size = 1f; //Elite=1; NpcText00 = "Hey citizen! You look like a stout one. We guards are spread a little thin out here, and I could use you help..."; Equip(new Longsword(), new StormwindGuardShield()); Loots = new BaseTreasure[] { new BaseTreasure(StormwindGuardsDrops.MarshalMcBride, 100f), new BaseTreasure(Drops.MoneyB, 100f) }; //Quests = new BaseQuest[] { new Kobold_Camp_Cleanup(), new Investigate_Echo_Ridge(), new Skirmish_at_Echo_Ridge(), new Report_to_Goldshire() }; }
public MoonPriestessAmara() : base() { Name = "Moon Priestess Amara"; Id = 2151; Model = 1681; Level = RandomLevel(25); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 4526; Block = 0; ResistArcane = 0; ResistFire = 1 * Level; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x0580006; BaseMana = 0; BoundingRadius = 0.420f; CombatReach = 1.2f; Size = 0.85f; Speed = 2.9f; WalkSpeed = 2.9f; RunSpeed = 5.9f; Str = (int)(Level * 2.5f); Faction = Factions.Darnasus; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } NpcType = 7; NpcFlags = (int)NpcActions.Dialog; //Item( int _model, InventoryTypes _inventoryType, int _quality, int _subclass, int _objectclass, int _sheath, int param1, int param2, int param3 ) Equip(new Item(24930, InventoryTypes.Ranged, 2, 2, 2, 0, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(Drops.MoneyA, 100f) }; /*****************************/ BCAddon.Hp(this, 285, 25); /*****************************/ }
public ApothecaryVallia() : base() { Name = "Apothecary Vallia"; Guild = "Royal Apothecary Society"; Id = 5731; Model = 4108; Level = RandomLevel(20); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 3 * Level; Block = 0; ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x018480046; BaseHitPoints = 16 + 10 * Level; BaseMana = 0; BoundingRadius = 0.31000f; CombatReach = 1.52f; Size = 1f; Speed = 3.06f; WalkSpeed = 3.06f; RunSpeed = 6.06f; Str = (int)(Level / 2.5f); Faction = Factions.Undercity; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } NpcType = (int)NpcTypes.Undead; NpcFlags = 0; Equip(new Item(12236, InventoryTypes.MainGauche, 2, 4, 2, 7, 0, 0, 0), new Item(21095, InventoryTypes.RangeRight, 2, 19, 2, 0, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(OtherUndeadDrops.ApothecaryVallia, 100f), new BaseTreasure(Drops.MoneyB, 100f) }; }
public ApothecaryZamah() : base() { Name = "Apothecary Zamah"; Guild = "Royal Apothecary Society"; Id = 3419; Model = 1814; Level = RandomLevel(22); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 3 * Level; Block = 0; ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x08480046; BaseHitPoints = 16 + 10 * Level; BaseMana = 0; BoundingRadius = 0.31000f; CombatReach = 1.52f; Size = 1f; Speed = 3.06f; WalkSpeed = 3.06f; RunSpeed = 6.06f; Str = (int)(Level / 2.5f); Faction = Factions.Undercity; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingNpcAI(this); } NpcType = (int)NpcTypes.Undead; NpcFlags = (int)NpcActions.Dialog; Equip(new Item(7474, InventoryTypes.MainGauche, 2, 14, 1, 0, 0, 0, 0), new Item(6534, InventoryTypes.HeldInHand, 4, 0, 2, 0, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(OtherUndeadDrops.ApothecaryZamah, 100f), new BaseTreasure(Drops.MoneyB, 100f) }; }
public MarshalDughan() : base() { Name = "Marshal Dughan"; Id = 240; Model = 1985; Level = RandomLevel(25); SetDamage(1f + 3f * Level, 1f + 3.5 * Level); AttackSpeed = 1500; Armor = 40 * Level; Block = 2 * Level; Flags1 = 0x08480046; NpcFlags = (int)NpcActions.Dialog; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; ResistShadow = 0; Str = (int)(Level / 1.5f); BaseHitPoints = 350; BaseMana = 0; BoundingRadius = 0.3077550f; CombatReach = 1.300f; Speed = 3.1f; WalkSpeed = 3.1f; RunSpeed = 6.1f; Faction = Factions.Stormwind; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } //Equip( new Shortsword() ); Equip(new BarbedClub()); NpcType = (int)NpcTypes.Humanoid; Size = 1f; Loots = new BaseTreasure[] { new BaseTreasure(StormwindGuardsDrops.MarshalDughan, 100f), new BaseTreasure(Drops.MoneyA, 100f) }; //Quests = new BaseQuest[] { new The_Fargodeep_Mine(), new The_Jasperlode_Mine(), new Further_Concerns(), new Cloth_and_Leather_Armor(), new Westbrook_Garrison_Needs_Help(), new Manhunt() }; }
public AllianceSpiritGuide() : base() { Id = 13116; Model = 13336; Level = RandomLevel(60); AttackSpeed = 2000; BoundingRadius = 0.5500000f; Name = "Alliance Spirit Guide"; //Guild="House of Barov"; Flags1 = 0x080000; Size = 1.0f; Speed = 4.05f; WalkSpeed = 4.05f; RunSpeed = 7.05f; ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; ResistShadow = 0; Str = (int)(Level * 2.5f); NpcType = (int)NpcTypes.Humanoid; Armor = Level * 30; BaseHitPoints = 5760; NpcFlags = (int)NpcActions.BattleFieldSpiritHealer; CombatReach = 2.5f; SetDamage(1f + 3f * Level, 1f + 3.5 * Level); ManaType = 0; BaseMana = 0; Faction = Factions.Alliance; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } Elite = 1; Equip(new Item(6454, InventoryTypes.MainGauche, 2, 15, 1, 3, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(DropsME.MoneyElite1, 100f) }; }
public AndronGant() : base() { Name = "Andron Gant"; Id = 6522; Model = 3859; Level = RandomLevel(15); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 3 * Level; Block = 0; ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x018480046; BaseHitPoints = 16 + 10 * Level; BaseMana = 0; BoundingRadius = 0.31000f; CombatReach = 1.52f; Size = 1f; Speed = 3.02f; WalkSpeed = 3.02f; RunSpeed = 6.02f; Str = (int)(Level / 2.5f); Faction = Factions.Undercity; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } NpcType = (int)NpcTypes.Undead; NpcFlags = (int)NpcActions.Dialog; Equip(new Item(6443, InventoryTypes.TwoHanded, 2, 15, 1, 3, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(OtherUndeadDrops.AndronGant, 100f), new BaseTreasure(Drops.MoneyB, 100f) }; }
public AlyssaBlaye() : base() { Name = "Alyssa Blaye"; Id = 5665; Model = 3883; Level = RandomLevel(20); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 3 * Level; Block = 0; ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x010480006; BaseHitPoints = 16 + 10 * Level; BaseMana = 0; BoundingRadius = 0.21000f; CombatReach = 1.52f; Size = 1f; Speed = 3f; WalkSpeed = 3f; RunSpeed = 6f; Str = (int)(Level / 2.5f); Faction = Factions.Horde; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } NpcType = (int)NpcTypes.Undead; NpcFlags = 0; Equip(new Item(7483, InventoryTypes.MainGauche, 2, 7, 1, 3, 0, 0, 0), new Item(1684, InventoryTypes.Shield, 4, 6, 1, 4, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(OtherUndeadDrops.AlyssaBlaye, 100f), new BaseTreasure(Drops.MoneyB, 100f) }; }
public DeputyWillem() : base() { Name = "Deputy Willem"; Id = 823; Model = 2072; Level = RandomLevel(18); SetDamage(1f + 3f * Level, 1f + 3.5 * Level); AttackSpeed = 1500; Armor = 40 * Level; Block = 2 * Level; Flags1 = 0x08080066; NpcFlags = (int)NpcActions.Dialog; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; ResistShadow = 0; Str = (int)(Level / 1.5f); BaseHitPoints = 210; BaseMana = 0; BoundingRadius = 0.3077550f; CombatReach = 1.300f; Speed = 3.1f; WalkSpeed = 3.1f; RunSpeed = 6.1f; Faction = Factions.Stormwind; if (this.SpawnerLink != null && SpawnerLink.TrajetGuid > 0) { AIEngine = new PatrolAI(this); } else { AIEngine = new StandingGuardAI(this); } Equip(new Shortsword()); NpcType = (int)NpcTypes.Humanoid; Size = 1f; Loots = new BaseTreasure[] { new BaseTreasure(StormwindGuardsDrops.DeputyWillem, 100f), new BaseTreasure(Drops.MoneyA, 100f) }; //Quests = new BaseQuest[] { new A_Threat_Within(), new Bounty_on_Garrick_Padfoot(), new Brotherhood_of_Thieves(), new Eagan_Peltskinner(), new Milly_Osworth() }; }
private void OnDisable() { if (m_CurrentTarget == null) { return; } switch (m_CurrentType) { case eMapPointType.FISH: FishAI fish = m_CurrentTarget.GetComponent <FishAI>(); fish.OnSpawn -= ShowPoint; fish.OnDeath -= HidePoint; break; case eMapPointType.PATROL: PatrolAI patrol = m_CurrentTarget.GetComponent <PatrolAI>(); patrol.OnSpawn -= ShowPoint; patrol.OnDeath -= HidePoint; break; case eMapPointType.FISHVARIANT: FishVariantAI fishVariant = m_CurrentTarget.GetComponent <FishVariantAI>(); fishVariant.OnSpawn -= ShowPoint; fishVariant.OnDeath -= HidePoint; break; case eMapPointType.TANK: TankAI tank = m_CurrentTarget.GetComponent <TankAI>(); tank.OnSpawn -= ShowPoint; tank.OnDeath -= HidePoint; break; //case eMapPointType.PLAYER: // m_CurrentPlayer.OnSpawnBegin -= ShowPoint; // m_CurrentPlayer.OnDeathBegin -= HidePoint; // break; } UIPanelRadar.Instance.UpdatePoint -= UpdatePosition; }
public KoboldLaborer() : base() { Id = 80; Level = RandomLevel(3, 4); RunSpeed = 7f; WalkSpeed = 3f; AttackSpeed = 2000; Armor = 1 * Level; Block = 0; ResistArcane = 0; ResistFire = 3 * Level; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x080000; AIEngine = new PatrolAI(this); AttackBonii(2000, 2000); BaseMana = 0; BaseHitPoints = 16 + 4 * Level; BoundingRadius = 0.726000f; SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); NpcType = 7; Model = 365; NpcFlags = 0; Name = "Kobold Laborer"; CombatReach = 0.12f; Unk3 = 7; Size = 0.85f; Str = (int)(Level / 2.5f); AIEngine = new PatrolAI(this); Faction = Factions.NoFaction; Equip(new Item(7493, InventoryTypes.OneHand, 0, 1, 13, 3, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(Drops.MoneyA, 100f) , new BaseTreasure(KoboldDrops.KoboldLaborer, 100f) }; /*****************************/ BCAddon.Hp(this, 28, 3); /*****************************/ }
private FleeAI fleeAI; //a variable used to check if the AI is in fleeing state #endregion private void Start() { //set all the variables to thier respective component values moveAI = GetComponent <MoveAI>(); patrolAI = GetComponent <PatrolAI>(); attackAI = GetComponent <AttackAI>(); fleeAI = GetComponent <FleeAI>(); enemyScript = GetComponent <Enemy>(); isSeeking = GetComponent <MoveAI>().isSeeking; //Debugging to check if objects are attached correctly if (moveAI == null) { Debug.LogError("moveAI not attached to StateMachine"); } if (patrolAI == null) { Debug.LogError("patrolAI not attached to StateMachine"); } //start the program in the patrol state ChangeStateTo("Patrol"); }
public MogroshBrute() : base() { Name = "Mo'grosh Brute"; Id = 1180; Model = 14403; Level = RandomLevel(19, 20); ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = Level; ResistShadow = 0; Str = (int)(Level * 4.85f); NpcType = (int)NpcTypes.Humanoid; Armor = (int)(Level * 29.2); Block = Level; SetDamage(1f + 3.5f * Level, 1f + 4.0 * Level); ManaType = 1; BaseMana = 100; AttackSpeed = 3000; BoundingRadius = 1f; CombatReach = 1.7f; Size = 1.15f; Speed = 2.5f; WalkSpeed = 2.5f; RunSpeed = 5.5f; Faction = Factions.Monster; AIEngine = new PatrolAI(this); Flags1 = 0x080000; Elite = 1; LearnSpell(6190, SpellsTypes.Defensive); LearnSpell(8198, SpellsTypes.Defensive); Equip(new Item(3502, (InventoryTypes)17, 2, 5, 2, 1, 0, 0, 0)); BCAddon.Hp(this, 1463, 19); Loots = new BaseTreasure[] { new BaseTreasure(MogroshDrops.MogroshBrute, 100f) , new BaseTreasure(DropsME.MoneyElite1, 100f) }; }
public MogroshOgre() : base() { Name = "Mo'grosh Ogre"; Id = 1178; Model = 1122; Level = RandomLevel(18, 19); ResistArcane = 0; ResistFire = 0; ResistFrost = 0; ResistHoly = 0; ResistNature = Level; ResistShadow = 0; Str = (int)(Level * 4.85f); NpcType = (int)NpcTypes.Humanoid; Armor = (int)(Level * 29.2); Block = Level; SetDamage(1f + 3.5f * Level, 1f + 4.0 * Level); ManaType = 0; BaseMana = 1200 + Level; AttackSpeed = 2000; BoundingRadius = 0.9f; CombatReach = 1.6f; Size = 1.1f; Speed = 2.5f; WalkSpeed = 2.5f; RunSpeed = 5.5f; Faction = Factions.Monster; AIEngine = new PatrolAI(this); Flags1 = 0x020; Elite = 1; LearnSpell(5164, SpellsTypes.Offensive); LearnSpell(3229, SpellsTypes.Defensive); Equip(new Item(7440, (InventoryTypes)13, 2, 4, 2, 3, 0, 0, 0)); BCAddon.Hp(this, 1272, 18); Loots = new BaseTreasure[] { new BaseTreasure(MogroshDrops.MogroshOgre, 100f) , new BaseTreasure(DropsME.MoneyElite1, 100f) }; }
public void Init(GameObject target, eMapPointType type) { m_CurrentTarget = target; m_CurrentType = type; m_Image = this.GetComponent <Image>(); m_Color = m_Image.color; FindRadarCenter(); CalculatePosition(); switch (m_CurrentType) { case eMapPointType.FISH: FishAI fish = target.GetComponent <FishAI>(); fish.OnSpawn += ShowPoint; fish.OnDeath += HidePoint; break; case eMapPointType.PATROL: PatrolAI patrol = target.GetComponent <PatrolAI>(); patrol.OnSpawn += ShowPoint; patrol.OnDeath += HidePoint; break; case eMapPointType.FISHVARIANT: FishVariantAI fishVariant = target.GetComponent <FishVariantAI>(); fishVariant.OnSpawn += ShowPoint; fishVariant.OnDeath += HidePoint; break; case eMapPointType.TANK: TankAI tank = target.GetComponent <TankAI>(); tank.OnSpawn += ShowPoint; tank.OnDeath += HidePoint; break; } UIPanelRadar.Instance.UpdatePoint += UpdatePosition; }
public KoboldVermin() : base() { Name = "Kobold Vermin"; Id = 6; Model = 10913; Level = RandomLevel(1, 2); SetDamage(1f + 1.8f * Level, 1f + 2.5 * Level); AttackSpeed = 2000; Armor = 3 * Level; Block = 0; ResistArcane = 0; ResistFire = 1 * Level; ResistFrost = 0; ResistHoly = 0; ResistNature = 0; Flags1 = 0x080000; BaseMana = 0; BoundingRadius = 0.561000f; CombatReach = 0.12f; Size = 0.7f; Speed = 3f; WalkSpeed = 3f; RunSpeed = 6f; Str = (int)(Level / 2.5f); Faction = Factions.NoFaction; AIEngine = new PatrolAI(this); NpcType = 7; //equipmodel=0 5010 2 10 2 17 2 0 0 0 //Item( int _model, InventoryTypes _inventoryType, int _quality, int _subclass, int _objectclass, int _sheath, int param1, int param2, int param3 ) Equip(new Item(5010, InventoryTypes.TwoHanded, 10, 2, 17, 2, 0, 0, 0)); Loots = new BaseTreasure[] { new BaseTreasure(Drops.MoneyA, 100f) , new BaseTreasure(KoboldDrops.KoboldVermin, 100f) }; /*****************************/ BCAddon.Hp(this, 26, 1); /*****************************/ }
void Start() { sense = GetComponent<OmniSense> (); patrolAI = GetComponent<PatrolAI> (); objectToFollow = null; }
public void SpawnMobs(int fishCount, int fishVariantCount, int patrolCount, int tankCount) { if (m_bAutoSpawn == false) { return; } List <Player> pList = InGamePlayerManager.Instance.Players; Vector3 Center = new Vector3(); Center.Set(0, 0, 0); for (int i = 0; i < pList.Count; i++) { Center += pList[i].transform.position; } Center /= pList.Count; Vector3 spawnTarget = Vector3.forward; for (int i = 0; i < 30; i++) { spawnTarget = Vector3.forward; spawnTarget = Quaternion.AngleAxis(Random.Range(1f, 360f), Vector3.up) * spawnTarget; spawnTarget *= Random.Range(70f, 75f); spawnTarget += Center; if (Physics.Linecast(Center, spawnTarget, 1 << LayerMask.NameToLayer("Obstcale"))) { continue; } else { for (int j = 0; j < fishCount; j++) { if (m_FishCount > 20) { break; } m_GOFish = ObjectPool.m_Instance.LoadGameObjectFromPool(3100); if (m_GOFish == null) { return; } m_GOFish.transform.position = spawnTarget; m_GOFish.SetActive(true); m_FishCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOFish, eMapPointType.FISH); } } for (int j = 0; j < fishVariantCount; j++) { if (m_FishVariantCount > 3) { break; } m_GOFishVariant = ObjectPool.m_Instance.LoadGameObjectFromPool(3300); if (m_GOFishVariant == null) { return; } m_GOFishVariant.transform.position = spawnTarget; m_GOFishVariant.SetActive(true); m_FishVariantCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOFishVariant, eMapPointType.FISHVARIANT); } } for (int j = 0; j < patrolCount; j++) { if (m_PatrolCount > 30) { break; } m_GOPatrol = ObjectPool.m_Instance.LoadGameObjectFromPool(3200); if (m_GOPatrol == null) { return; } m_GOPatrol.transform.position = spawnTarget; m_GOPatrol.SetActive(true); PatrolAI patrolAI = m_GOPatrol.GetComponent <PatrolAI>(); patrolAI.m_bGoIdle = true; m_PatrolCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOPatrol, eMapPointType.PATROL); } } for (int j = 0; j < tankCount; j++) { if (m_TankCount > 5) { break; } m_GOTank = ObjectPool.m_Instance.LoadGameObjectFromPool(3400); if (m_GOTank == null) { return; } m_GOTank.transform.position = spawnTarget; m_GOTank.SetActive(true); m_TankCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOTank, eMapPointType.TANK); } } break; } } Debug.Log("Fish:" + m_FishCount + " Fish2:" + m_FishVariantCount + " Patrol:" + m_PatrolCount + " Tank:" + m_TankCount); }
public void SpawnMobs(int fishCount, int fishVariantCount, int patrolCount, int tankCount, Transform center, float minRadius, float maxRadius) { Vector3 spawnTarget = center.forward; for (int i = 0; i < fishCount; i++) { for (int j = 0; j < 30; j++) { spawnTarget = Vector3.forward; spawnTarget = Quaternion.AngleAxis(Random.Range(1f, 360f), Vector3.up) * spawnTarget; spawnTarget *= Random.Range(minRadius, maxRadius); spawnTarget += center.position; if (Physics.Linecast(center.position, spawnTarget, 1 << LayerMask.NameToLayer("Obstcale"))) { continue; } else { m_GOFish = ObjectPool.m_Instance.LoadGameObjectFromPool(3100); if (m_GOFish == null) { return; } m_GOFish.transform.position = spawnTarget; m_GOFish.SetActive(true); m_FishCount++; if (UIPanelRadar.Instance != null) { UIPanelRadar.Instance.AddPointPrefab(m_GOFish, eMapPointType.FISH); } break; } } } for (int i = 0; i < fishVariantCount; i++) { for (int j = 0; j < 30; j++) { spawnTarget = Vector3.forward; spawnTarget = Quaternion.AngleAxis(Random.Range(1f, 360f), Vector3.up) * spawnTarget; spawnTarget *= Random.Range(minRadius, maxRadius); spawnTarget += center.position; if (Physics.Linecast(center.position, spawnTarget, 1 << LayerMask.NameToLayer("Obstcale"))) { continue; } else { m_GOFishVariant = ObjectPool.m_Instance.LoadGameObjectFromPool(3300); if (m_GOFishVariant == null) { return; } m_GOFishVariant.transform.position = spawnTarget; m_GOFishVariant.SetActive(true); m_FishVariantCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOFishVariant, eMapPointType.FISHVARIANT); } break; } } } for (int i = 0; i < patrolCount; i++) { for (int j = 0; j < 30; j++) { spawnTarget = Vector3.forward; spawnTarget = Quaternion.AngleAxis(Random.Range(1f, 360f), Vector3.up) * spawnTarget; spawnTarget *= Random.Range(minRadius, maxRadius); spawnTarget += center.position; if (Physics.Linecast(center.position, spawnTarget, 1 << LayerMask.NameToLayer("Obstcale"))) { continue; } else { m_GOPatrol = ObjectPool.m_Instance.LoadGameObjectFromPool(3200); if (m_GOPatrol == null) { return; } m_GOPatrol.transform.position = spawnTarget; m_GOPatrol.SetActive(true); PatrolAI patrolAI = m_GOPatrol.GetComponent <PatrolAI>(); patrolAI.m_bGoIdle = true; m_PatrolCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOPatrol, eMapPointType.PATROL); } break; } } } for (int i = 0; i < tankCount; i++) { for (int j = 0; j < 30; j++) { spawnTarget = Vector3.forward; spawnTarget = Quaternion.AngleAxis(Random.Range(1f, 360f), Vector3.up) * spawnTarget; spawnTarget *= Random.Range(minRadius, maxRadius); spawnTarget += center.position; if (Physics.Linecast(center.position, spawnTarget, 1 << LayerMask.NameToLayer("Obstcale"))) { continue; } else { m_GOTank = ObjectPool.m_Instance.LoadGameObjectFromPool(3400); if (m_GOTank == null) { return; } m_GOTank.transform.position = spawnTarget; m_GOTank.SetActive(true); m_PatrolCount++; if (UIInGameMain.Instance != null) { UIInGameMain.Instance.AddRadarPoint(m_GOTank, eMapPointType.TANK); } break; } } } }
public void SpawnPatrolAI(int playerID) { if (m_patrolAI == null) { m_patrolAI = PhotonNetwork.Instantiate("PatrolAIPhotonView", Vector3.zero, Quaternion.identity, 0); } if (m_patrolAI != null) { m_ai = m_patrolAI.GetComponentInChildren<PatrolAI>(); m_ai.Initialise(m_nodes, playerID); m_aiSpawned = true; } }