Ejemplo n.º 1
0
        /// <summary>
        /// update the game item category lists
        /// </summary>
        public void UpdateInventoryCategories()
        {
            Potions.Clear();
            Weapons.Clear();
            Treasure.Clear();
            Relics.Clear();

            foreach (var gameItemQuantity in _inventory)
            {
                if (gameItemQuantity.GameItem is Potion)
                {
                    Potions.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Weapon)
                {
                    Weapons.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Treasure)
                {
                    Treasure.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Relic)
                {
                    Relics.Add(gameItemQuantity);
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdateInventoryCategories()
        {
            Consumables.Clear();
            Weapons.Clear();
            KeyItems.Clear();
            Statements.Clear();

            foreach (var gameItemQuantity in _inventory)
            {
                if (gameItemQuantity.GameItem is Consumable)
                {
                    Consumables.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Weapon)
                {
                    Weapons.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is KeyItem)
                {
                    KeyItems.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Statement)
                {
                    Statements.Add(gameItemQuantity);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Clears the value of the given property.
        /// </summary>
        /// <param name="propertyName">The name of the property whose value to clear.</param>
        public void ClearPropertyValue(string propertyName)
        {
            switch (propertyName)
            {
            case nameof(Size):
                Size = Sizes.NotDefined;
                break;

            case nameof(Engines):
                Engines.Clear();
                break;

            case nameof(Weapons):
                Weapons.Clear();
                break;

            case nameof(Crew):
                Crew = CrewTypes.NotDefined;
                break;

            case nameof(Name):
                Name = string.Empty;
                break;
            }
        }
Ejemplo n.º 4
0
 public void UpdateInventoryCategories()
 {
     Potions.Clear();
     Treasures.Clear();
     Weapons.Clear();
     Allies.Clear();
     foreach (var GameItem in _inventory)
     {
         if (GameItem.GameItem is Potion)
         {
             Potions.Add(GameItem);
         }
         if (GameItem.GameItem is Treasure)
         {
             Treasures.Add(GameItem);
         }
         if (GameItem.GameItem is Weapon)
         {
             Weapons.Add(GameItem);
         }
         if (GameItem.GameItem is Allies)
         {
             Allies.Add(GameItem);
         }
     }
 }
Ejemplo n.º 5
0
        public void UpdateInventoryCategories()
        {
            MediPack.Clear();
            Weapons.Clear();
            Currency.Clear();
            Clue.Clear();

            foreach (var gameItem in _inventory)
            {
                if (gameItem is Potion)
                {
                    MediPack.Add(gameItem);
                }
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);
                }
                if (gameItem is Coin)
                {
                    Currency.Add(gameItem);
                }
                if (gameItem is Clues)
                {
                    Clue.Add(gameItem);
                }
            }
        }
Ejemplo n.º 6
0
    public void Release()
    {
        foreach (var wp in Weapons)
        {
            wp.OnDestroy();
        }

        Weapons.Clear();
    }
Ejemplo n.º 7
0
 /// <summary>
 /// Removes all potentially loaded data.
 /// </summary>
 public void Unload()
 {
     Info = new ScenarioInfo();
     Factions.Clear();
     Units.Clear();
     Areas.Clear();
     Connections.Clear();
     Items.Clear();
     Weapons.Clear();
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
        public void UpdateWeapons()
        {
            Weapons.Clear();

            foreach (var item in Inventory)
            {
                Console.WriteLine(item.GetType());
                if (item.Type == ItemType.Weapons)
                {
                    Weapons.Add(item as Weapon);
                }
            }
        }
Ejemplo n.º 10
0
    protected void Deactivate()
    {
        //Debug.Log(gameObject.name + "CW deactivate");

        foreach (KeyValuePair <E_WeaponID, WeaponBase> weaponPair in Weapons)
        {
            if (WeaponManager.Instance)
            {
                WeaponManager.Instance.Return(weaponPair.Value);
            }
        }

        Weapons.Clear();

        CurrentWeapon = E_WeaponID.None;
    }
Ejemplo n.º 11
0
        /// <summary>
        /// udpate game item category list
        /// </summary>
        public void UpdateInventoryCategories()
        {
            Weapons.Clear();
            Provisions.Clear();

            foreach (var gameItem in _inventory)
            {
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);
                }
                if (gameItem is Provisions)
                {
                    Provisions.Add(gameItem);
                }
            }
        }
Ejemplo n.º 12
0
        protected override void OnUpdate(TickEventArgs args)
        {
            base.OnUpdate(args);

            //Grab local player
            LocalPlayer.Reset();
            ViewMatrix.Reset();
            //GameRules.Reset();
            PlayerResources.Reset();
            ClientState.Reset();
            GameDirectory.Reset();

            BaseEntitites.Clear();
            PlayersOld.Clear();
            PlayersOld.CopyFrom(Players);
            Players.Clear();
            Weapons.Clear();

            //Load map
            if (ClientState.Value != null && ClientState.Value.Map.Value != null)
            {
                if (ClientState.Value.Map.Value != lastMap)
                {
                    var path = Path.Combine(GameDirectory.Value, ClientState.Value.Map.Value);
                    //try
                    //{
                    lastMap = ClientState.Value.Map.Value;
                    if (File.Exists(path))
                    {
                        using (var str = new FileStream(path, FileMode.Open, FileAccess.Read))
                        {
                            var bsp = new BSPFile(str);
                            Map = bsp;
                        }
                        //}catch(Exception ex)
                        //{
                        //    Program.Logger.Error("Failed to parse map \"{0}\": {1}", path, ex.Message);
                        //}
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public void UpdateInventoryCategories()
        {
            Weapons.Clear();
            ActionItems.Clear();

            foreach (var gameItemQuantity in _Inventory)
            {
                if (gameItemQuantity.GameItem is Weapon)
                {
                    Weapons.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is ActionItem)
                {
                    ActionItems.Add(gameItemQuantity);
                }
                if (gameItemQuantity.GameItem is Currency)
                {
                    Booty.Add(gameItemQuantity);
                }
            }
        }
Ejemplo n.º 14
0
        public void UpdateInventoryCategories()
        {
            Drugs.Clear();
            Weapons.Clear();
            Loot.Clear();

            foreach (var gameItem in _inventory)
            {
                if (gameItem is Drug)
                {
                    Drugs.Add(gameItem);
                }
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);
                }
                if (gameItem is Loot)
                {
                    Loot.Add(gameItem);
                }
            }
        }
Ejemplo n.º 15
0
 public void RemoveAllWeapons()
 {
     Weapons.Clear();
 }
Ejemplo n.º 16
0
 private void UpdateWeapons()
 {
     Weapons.Clear();
     Weapons.AddRange(weaponHolder.Value.GetAllChildren());
     WeaponAmmoManagment();
 }
Ejemplo n.º 17
0
        public void Load(byte[] save)
        {
            if (save == null)
            {
                throw new ArgumentNullException(nameof(save));
            }
            if (save.Length != SaveSize)
            {
                throw new ArgumentOutOfRangeException(nameof(save.Length));
            }

            _save            = save;
            using var stream = new MemoryStream(_save);
            using var reader = new BinaryReader(stream, Encoding.Unicode);

            stream.Seek(0x00004, SeekOrigin.Begin);
            HeaderId = reader.ReadBytes(12);

            stream.Seek(0x00024, SeekOrigin.Begin);
            InGameTime = reader.ReadInt32();

            stream.Seek(0x0002C, SeekOrigin.Begin);
            Chapter = reader.ReadInt32();

            stream.Seek(0x00034, SeekOrigin.Begin);
            Name = new string(reader.ReadChars(35)).TrimEnd('\0');

            stream.Seek(0x3056C, SeekOrigin.Begin);
            Money = reader.ReadInt32();

            stream.Seek(0x3871C, SeekOrigin.Begin);
            Experience = reader.ReadInt32();

            stream.Seek(0x30570, SeekOrigin.Begin);
            Inventory.Clear();
            for (int i = 0; i < InventoryItemsCount; i++)
            {
                Inventory.Add(Item.Read(reader, i));
            }

            stream.Seek(0x31170, SeekOrigin.Begin);
            CorpseInventory.Clear();
            for (int i = 0; i < CorpseInventoryItemsCount; i++)
            {
                CorpseInventory.Add(Item.Read(reader, i));
            }

            stream.Seek(0x31D70, SeekOrigin.Begin);
            Weapons.Clear();
            for (int i = 0; i < Weapon.Weapons.Count; i++)
            {
                Weapons.Add(Weapon.Read(reader, i));
            }

            stream.Seek(0x324BC, SeekOrigin.Begin);
            Chips.Clear();
            for (int i = 0; i < ChipsCount; i++)
            {
                Chips.Add(Chip.Read(reader, i));
            }
        }
Ejemplo n.º 18
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++;
        }