Пример #1
0
            internal static void Initialize()
            {
                _allTurrets = ObjectManager.Get <Obj_AI_Turret>().ToList();
                _allies     = new List <Obj_AI_Turret>();
                _enemies    = new List <Obj_AI_Turret>();

                if (!Bootstrap.IsSpectatorMode)
                {
                    _allies  = AllTurrets.FindAll(o => o.IsAlly);
                    _enemies = AllTurrets.FindAll(o => o.IsEnemy);
                }

                // Clearing
                GameObject.OnDelete += delegate(GameObject sender, EventArgs args)
                {
                    if (sender is Obj_AI_Turret)
                    {
                        _allTurrets.RemoveAll(o => o.IdEquals(sender));

                        if (!Bootstrap.IsSpectatorMode)
                        {
                            _allies.RemoveAll(o => o.IdEquals(sender));
                            _enemies.RemoveAll(o => o.IdEquals(sender));
                        }
                    }
                };
            }
Пример #2
0
        private void GameObject_OnDelete(GameObject sender, EventArgs args)
        {
            AllObjects.Remove(sender);

            var hero = sender as AIHeroClient;

            if (hero != null)
            {
                AllHeroes.Remove(hero);
                if (hero.IsEnemy)
                {
                    EnemyHeroes.Remove(hero);
                    AllEnemies.Remove(hero);
                }
                else
                {
                    AllyHeroes.Remove(hero);
                    AllAllies.Remove(hero);
                }

                return;
            }

            var minion = sender as Obj_AI_Minion;

            if (minion != null)
            {
                if (minion.Team != GameObjectTeam.Neutral)
                {
                    if (minion.GetMinionType().HasFlag(Extensions.MinionTypes.Ward))
                    {
                        AllWards.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyWards.Remove(minion);
                        }
                        else
                        {
                            AllyWards.Remove(minion);
                        }
                    }
                    else
                    {
                        AllMinions.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyMinions.Remove(minion);
                            AllEnemies.Remove(minion);
                        }
                        else
                        {
                            AllyMinions.Remove(minion);
                            AllAllies.Remove(minion);
                        }
                    }
                }
                else if (minion.Name != "WardCorpse")
                {
                    switch (minion.GetJungleType())
                    {
                    case Extensions.JungleType.Small:
                        SmallJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Large:
                        LargeJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Epic:
                        EpicJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Legendary:
                        LegendaryJungleMinions.Remove(minion);
                        break;
                    }

                    AllJungleMinions.Remove(minion);
                }

                return;
            }

            var particle = sender as Obj_GeneralParticleEmitter;

            if (particle != null)
            {
                AllParticleEmitters.Remove(particle);
                return;
            }

            var turret = sender as Obj_AI_Turret;

            if (turret != null)
            {
                AllTurrets.Remove(turret);

                if (turret.IsEnemy)
                {
                    EnemyTurrets.Remove(turret);
                }
                else
                {
                    AllyTurrets.Remove(turret);
                }

                return;
            }

            var shop = sender as Obj_Shop;

            if (shop != null)
            {
                AllShops.Remove(shop);

                if (shop.IsAlly)
                {
                    AllyShops.Remove(shop);
                }
                else
                {
                    EnemyShops.Remove(shop);
                }

                return;
            }

            var spawnPoint = sender as Obj_SpawnPoint;

            if (spawnPoint != null)
            {
                AllSpawnPoints.Remove(spawnPoint);

                if (spawnPoint.IsAlly)
                {
                    AllySpawnPoints.Remove(spawnPoint);
                }
                else
                {
                    EnemySpawnPoints.Remove(spawnPoint);
                }
            }

            var inhibitor = sender as Obj_BarracksDampener;

            if (inhibitor != null)
            {
                AllInhibitors.Remove(inhibitor);

                if (inhibitor.IsAlly)
                {
                    AllyInhibitors.Remove(inhibitor);
                }
                else
                {
                    EnemyInhibitors.Remove(inhibitor);
                }
            }

            var nexus = sender as Obj_HQ;

            if (nexus != null)
            {
                AllNexus.Remove(nexus);

                if (nexus.IsAlly)
                {
                    AllyNexus = null;
                }
                else
                {
                    EnemyNexus = null;
                }
            }

            var missile = sender as MissileClient;

            if (missile != null)
            {
                AllMissiles.Remove(missile);

                if (missile.IsAlly)
                {
                    AllyMissiles.Remove(missile);
                }
                else
                {
                    EnemyMissiles.Remove(missile);
                }
            }
        }