Пример #1
0
 internal void CleanUp()
 {
     RegisterMyGridEvents(false);
     foreach (var grid in SubGrids)
     {
         if (grid == MyGrid)
         {
             continue;
         }
         RemSubGrids.Add(grid);
     }
     AddSubGrids.Clear();
     SubGridChanges();
     SubGrids.Clear();
     Obstructions.Clear();
     TargetAis.Clear();
     EntitiesInRange.Clear();
     Batteries.Clear();
     Targets.Clear();
     SortedTargets.Clear();
     BlockGroups.Clear();
     Weapons.Clear();
     WeaponsIdx.Clear();
     WeaponBase.Clear();
     AmmoInventories.Clear();
     Inventories.Clear();
     LiveProjectile.Clear();
     DeadProjectiles.Clear();
     ControllingPlayers.Clear();
     SourceCount           = 0;
     BlockCount            = 0;
     MyOwner               = 0;
     PointDefense          = false;
     FadeOut               = false;
     SupressMouseShoot     = false;
     OverPowered           = false;
     UpdatePowerSources    = false;
     AvailablePowerChanged = false;
     PowerIncrease         = false;
     RequestedPowerChanged = false;
     RequestIncrease       = false;
     DbReady               = false;
     Focus.Clean();
     MyShieldTmp        = null;
     MyShield           = null;
     MyPlanetTmp        = null;
     MyPlanet           = null;
     TerminalSystem     = null;
     LastWeaponTerminal = null;
     LastTerminal       = null;
     PowerDistributor   = null;
 }
Пример #2
0
 public void Launch(Transform actionPoint, Weapon fromWeapon, float initialLaunchForce)
 {
     if (Launched || IsLive)
     {
         return;                                                 //can't launch if we've already launched
     }
     //freeze the projectile
     worlditem.SetMode(WIMode.Hidden);
     //disable the arrow's collider - we're not depending on it for collisions any more
     worlditem.ActiveState       = WIActiveState.Invisible;
     worlditem.ActiveStateLocked = true;
     transform.position          = actionPoint.position;
     transform.rotation          = actionPoint.rotation;
     //add the live projectile
     LiveUpdater = gameObject.AddComponent <LiveProjectile>();
     LiveUpdater.Initialize(this, actionPoint, fromWeapon, initialLaunchForce);
     //we're a go!
     enabled  = true;
     Launched = true;
 }
Пример #3
0
        internal void CleanUp()
        {
            AiCloseTick = Session.Tick;

            MyGrid.Components.Remove <AiComponent>();

            for (int i = 0; i < MIds.Length; i++)
            {
                MIds[i] = 0;
            }

            if (Session.IsClient)
            {
                Session.SendUpdateRequest(MyGrid.EntityId, PacketType.ClientAiRemove);
            }

            Data.Repo.ControllingPlayers.Clear();
            Data.Repo.ActiveTerminal = 0;

            CleanSortedTargets();
            Construct.Clean();
            Obstructions.Clear();
            ObstructionsTmp.Clear();
            TargetAis.Clear();
            TargetAisTmp.Clear();
            EntitiesInRange.Clear();
            Batteries.Clear();
            Targets.Clear();
            Weapons.Clear();
            WeaponsIdx.Clear();
            WeaponBase.Clear();
            LiveProjectile.Clear();
            DeadProjectiles.Clear();
            NearByShieldsTmp.Clear();
            NearByFriendlyShields.Clear();
            StaticsInRange.Clear();
            StaticsInRangeTmp.Clear();
            TestShields.Clear();
            NewEntities.Clear();
            SubGridsRegistered.Clear();
            SourceCount           = 0;
            BlockCount            = 0;
            AiOwner               = 0;
            ProjectileTicker      = 0;
            NearByEntities        = 0;
            NearByEntitiesTmp     = 0;
            MyProjectiles         = 0;
            AccelChecked          = false;
            PointDefense          = false;
            FadeOut               = false;
            SuppressMouseShoot    = false;
            OverPowered           = false;
            UpdatePowerSources    = false;
            AvailablePowerChanged = false;
            PowerIncrease         = false;
            RequestedPowerChanged = false;
            RequestIncrease       = false;
            DbReady               = false;
            GridInit              = false;
            TouchingWater         = false;
            Data.Clean();

            MyShield         = null;
            MyPlanetTmp      = null;
            MyPlanet         = null;
            TerminalSystem   = null;
            LastTerminal     = null;
            PowerDistributor = null;
            PowerBlock       = null;
            MyGrid           = null;
            PowerDistributor = null;
            Session          = null;
            Closed           = true;
            CanShoot         = true;
            Version++;
        }