internal static void Postfix(GearItem __instance)
 {
     if (__instance.name == TIN_CAN_NAME)
     {
         __instance.m_WeightKG = TIN_CAN_WEIGHT_KG;
     }
 }
示例#2
0
        /// <summary>
        /// Delete a gear item by his id.
        /// </summary>
        /// <param name="id">int.</param>
        public void DeleteGearitem(int id)
        {
            GearItem deletedItem = this.GetGearItem(id);

            Context.Gear.Remove(deletedItem);
            Context.SaveChanges();
        }
        internal static void Postfix(Panel_Cooking __instance)
        {
            GearItem cookedItem = __instance.GetSelectedFood();

            if (cookedItem == null || cookedItem.m_Cookable == null)
            {
                return;
            }

            CookingPotItem cookingPotItem = __instance.m_CookingPotInteractedWith;

            if (cookingPotItem == null)
            {
                return;
            }

            if (cookedItem.m_Cookable.m_PotableWaterRequiredLiters <= 0)
            {
                return;
            }

            float litersRequired    = cookedItem.m_Cookable.m_PotableWaterRequiredLiters;
            float additionalMinutes = litersRequired * __instance.m_MinutesToMeltSnowPerLiter * cookingPotItem.GetTotalCookMultiplier();

            __instance.m_Label_CookedItemCookTime.text = GetCookingTime(cookedItem.m_Cookable.m_CookTimeMinutes * cookingPotItem.GetTotalCookMultiplier()) + " (+" + GetCookingTime(additionalMinutes) + " " + Localization.Get("GAMEPLAY_ButtonMelt") + ")";
        }
示例#4
0
        internal static void Postfix(GearItem __instance)
        {
            if (__instance.name == "GEAR_RawLakeWhiteFish" ||
                __instance.name == "GEAR_RawSmallMouthBass" ||
                __instance.name == "GEAR_RawRainbowTrout" ||
                __instance.name == "GEAR_RawCohoSalmon")
            {
                float length = Mathf.Pow(__instance.m_WeightKG, 0.3333f);

                float lengthfactor = 1f;

                if (__instance.name == "GEAR_RawLakeWhiteFish")
                {
                    lengthfactor = 0.8f;
                }
                if (__instance.name == "GEAR_RawSmallMouthBass")
                {
                    lengthfactor = 0.9f;
                }
                if (__instance.name == "GEAR_RawRainbowTrout")
                {
                    lengthfactor = 0.8f;
                }
                if (__instance.name == "GEAR_RawCohoSalmon")
                {
                    lengthfactor = 0.74f;
                }

                __instance.gameObject.transform.localScale *= length * lengthfactor;
            }
        }
示例#5
0
    private static void Use(Panel_BreakDown panel, int toolInstanceID)
    {
        if (toolInstanceID == 0)
        {
            AccessTools.Field(typeof(Panel_BreakDown), "m_SelectedToolItemIndex").SetValue(panel, 0);
            return;
        }

        List <GearItem> tools = (List <GearItem>)AccessTools.Field(typeof(Panel_BreakDown), "m_Tools").GetValue(panel);
        int             index = -1;

        for (int i = 0; i < tools.Count; ++i)
        {
            GearItem tool = tools[i];
            if (tool != null && tool.m_InstanceID == toolInstanceID)
            {
                index = i;
                break;
            }
        }
        if (index == -1)
        {
            return;
        }

        AccessTools.Field(typeof(Panel_BreakDown), "m_SelectedToolItemIndex").SetValue(panel, index);
    }
示例#6
0
        protected override bool Prepare(GameObject gameObject)
        {
            string name = gameObject.name;

            if (name.EndsWith("_Prefab"))
            {
                name = name.Substring(0, name.Length - "_Prefab".Length);
            }
            name = name.Replace("OBJ_", "GEAR_");

            GameObject prefab = Resources.Load(name) as GameObject;

            if (prefab == null)
            {
                return(false);
            }

            GameObject instance = GameObject.Instantiate(prefab, gameObject.transform.position, gameObject.transform.rotation);

            instance.name = prefab.name;

            GearItem gearItem = instance.GetComponentInChildren <GearItem>();

            gearItem?.StickToGroundAndOrientOnSlope(instance.transform.position, NavMeshCheck.IgnoreNavMesh);

            GameObject.Destroy(gameObject);

            return(true);
        }
示例#7
0
        internal static float GetLitersToDrain(GearItem gearItem)
        {
            float availableFuel     = GetCurrentLiters(gearItem);
            float availableCapacity = GetTotalCapacityLiters(gearItem) - GetTotalCurrentLiters(gearItem);

            return(Mathf.Min(availableFuel, availableCapacity));
        }
示例#8
0
        private static float GetShoesToughness()
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();
            GearItem      gearItem      = playerManager.GetClothingInSlot(ClothingRegion.Feet, ClothingLayer.Top);

            return(gearItem?.m_ClothingItem?.m_Toughness ?? 0f);
        }
        private static void AddtoExistingStackWithException(GearItem gearItem)
        {
            bool      useDefaultStacking = UseDefaultStacking(gearItem);
            Inventory inventory          = GameManager.GetInventoryComponent();

            GearItem[] targetItems = inventory.GearInInventory(gearItem.name);
            foreach (GearItem eachTargetItem in targetItems)
            {
                if (eachTargetItem == gearItem)
                {
                    continue;
                }

                if (useDefaultStacking && eachTargetItem.GetRoundedCondition() == gearItem.GetRoundedCondition())
                {
                    eachTargetItem.m_StackableItem.m_Units++;
                    inventory.DestroyGear(gearItem.gameObject);
                    return;
                }

                if (!useDefaultStacking && CanBeMerged(eachTargetItem, gearItem))
                {
                    MergeIntoStack(gearItem.GetNormalizedCondition(), 1, eachTargetItem);
                    inventory.DestroyGear(gearItem.gameObject);
                    return;
                }
            }
        }
        internal static void Prefix(GearItem gi, ref bool __result)
        {
            if (gi == null)
            {
                return;
            }

            LiquidItem liquidItem = gi.m_LiquidItem;

            if (liquidItem == null || liquidItem.m_LiquidType != GearLiquidTypeEnum.Water)
            {
                return;
            }

            WaterSupply waterSupply = liquidItem.GetComponent <WaterSupply>();

            if (waterSupply == null)
            {
                waterSupply      = liquidItem.gameObject.AddComponent <WaterSupply>();
                gi.m_WaterSupply = waterSupply;
            }

            waterSupply.m_VolumeInLiters     = liquidItem.m_LiquidLiters;
            waterSupply.m_WaterQuality       = liquidItem.m_LiquidQuality;
            waterSupply.m_TimeToDrinkSeconds = liquidItem.m_TimeToDrinkSeconds;
            waterSupply.m_DrinkingAudio      = liquidItem.m_DrinkingAudio;
        }
 internal static void Prefix(GearItem __instance)
 {
     if (__instance.m_CookingPotItem)
     {
         ModUtils.GetOrCreateComponent <OverrideCookingState>(__instance);
     }
 }
        internal static bool Prefix(CookingPotItem __instance)
        {
            if (__instance.GetCookingState() == CookingPotItem.CookingState.Cooking)
            {
                return(true);
            }

            float waterAmount = WaterUtils.GetWaterAmount(__instance);

            if (waterAmount <= 0)
            {
                return(true);
            }

            bool potable = __instance.GetCookingState() == CookingPotItem.CookingState.Ready;

            GearItem gearItem = __instance.GetComponent <GearItem>();

            WaterSupply waterSupply = gearItem.m_WaterSupply;

            if (waterSupply == null)
            {
                waterSupply            = gearItem.gameObject.AddComponent <WaterSupply>();
                gearItem.m_WaterSupply = waterSupply;
            }

            waterSupply.m_VolumeInLiters     = waterAmount;
            waterSupply.m_WaterQuality       = potable ? LiquidQuality.Potable : LiquidQuality.NonPotable;
            waterSupply.m_TimeToDrinkSeconds = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply.m_TimeToDrinkSeconds;
            waterSupply.m_DrinkingAudio      = GameManager.GetInventoryComponent().GetPotableWaterSupply().m_WaterSupply.m_DrinkingAudio;

            GameManager.GetPlayerManagerComponent().UseInventoryItem(gearItem);

            return(false);
        }
示例#13
0
    public void TakeItem()
    {
        RaycastHit2D[] hits = new RaycastHit2D[1];
        Vector2        direction;

        if (transform.localScale.x >= 0)
        {
            direction = Vector2.right;
        }
        else
        {
            direction = Vector2.left;
        }
        GetComponent <BoxCollider2D>().Cast(direction, hits);
        RaycastHit2D hit = hits[0];

        if (hit.collider.tag == "GearItem")
        {
            GearItem item = hit.collider.GetComponent <GearItemScript>().gearItem;
            if (item.owner == null && gear.getItem(item.slot) == null)
            {
                EquipItem(item);
            }
        }
    }
示例#14
0
    public virtual void EquipItem(GearItem item)
    {
        GameObject inst = Instantiate(item.gameObject, Vector3.zero, Quaternion.identity);

        if (item.color != null)
        {
            inst.GetComponent <SpriteRenderer>().color = item.color;
        }
        if (inst.transform.localScale.x * transform.localScale.x < 0)
        {
            inst.transform.localScale += new Vector3((-2) * inst.transform.localScale.x, 0f, 0f);
        }
        inst.transform.SetParent(transform);
        inst.transform.localPosition = Vector3.zero;
        GearItem newItem = item.Clone();

        newItem.gameObject = inst;
        newItem.owner      = gameObject;
        //GearItem newItem = new GearItem { prefab = item.prefab, color = item.color, damage = item.damage, slot = item.slot, gameObject = inst, owner = gameObject };
        inst.transform.SendMessage("SetGearItem", newItem);
        gear.setItem(newItem);
        newItem.gameObject.transform.SendMessage("SetGearItem", newItem);
        if (item.gameObject != item.prefab)
        {
            Destroy(item.gameObject);
        }
    }
示例#15
0
        internal static void Refuel(GearItem gearItem)
        {
            Panel_Inventory_Examine panel = InterfaceManager.m_Panel_Inventory_Examine;

            float currentLiters  = GetCurrentLiters(panel.m_GearItem);
            float capacityLiters = GetCapacityLiters(panel.m_GearItem);

            if (Mathf.Approximately(currentLiters, capacityLiters))
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_AlreadyFilled"), false);
                return;
            }

            float totalCurrent = GetTotalCurrentLiters(panel.m_GearItem);

            if (totalCurrent < Implementation.MIN_LITERS)
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_NoKeroseneavailable"), false);
                return;
            }

            GameAudioManager.PlayGuiConfirm();
            InterfaceManager.m_Panel_GenericProgressBar.Launch(
                Localization.Get("GAMEPLAY_RefuelingProgress"),
                REFUEL_TIME,
                0,
                0,
                REFUEL_AUDIO,
                null,
                false,
                true,
                new OnExitDelegate(OnRefuelFinished));
        }
    private static void Use(Panel_BreakDown panel, int toolInstanceID)
    {
        if (toolInstanceID == 0)
        {
            panel.m_SelectedToolItemIndex = 0;
            return;
        }

        Il2Cpp.List <GearItem> tools = panel.m_Tools;

        int index = -1;

        for (int i = 0; i < tools.Count; ++i)
        {
            GearItem tool = tools[i];
            if (tool != null && tool.m_InstanceID == toolInstanceID)
            {
                index = i;
                break;
            }
        }

        if (index >= 0)
        {
            panel.m_SelectedToolItemIndex = index;
        }
    }
示例#17
0
        internal static void AddTotalCurrentLiters(float liters, GearItem excludeItem)
        {
            float remaining = liters;

            foreach (GameObject eachItem in GameManager.GetInventoryComponent().m_Items)
            {
                GearItem gearItem = eachItem.GetComponent <GearItem>();
                if (gearItem == null || gearItem == excludeItem)
                {
                    continue;
                }

                LiquidItem liquidItem = gearItem.m_LiquidItem;
                if (liquidItem == null || liquidItem.m_LiquidType != GearLiquidTypeEnum.Kerosene)
                {
                    continue;
                }

                float previousLiters = liquidItem.m_LiquidLiters;
                liquidItem.m_LiquidLiters = Mathf.Clamp(liquidItem.m_LiquidLiters + remaining, 0, liquidItem.m_LiquidCapacityLiters);
                float transferred = liquidItem.m_LiquidLiters - previousLiters;

                remaining -= transferred;

                if (Mathf.Abs(remaining) < MIN_LITERS)
                {
                    break;
                }
            }
        }
示例#18
0
        private static float GetGlovesToughness()
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();
            GearItem      gearItem      = playerManager.GetClothingInSlot(ClothingRegion.Hands, ClothingLayer.Base);

            return(gearItem?.m_ClothingItem?.m_Toughness ?? 0f);
        }
示例#19
0
        private static void Prefix(Inventory __instance, ref GameObject go)
        {
            var settings = nonStroyBearspearSettings.Instance;

            GearItem gearItem = go.GetComponent <GearItem>();

            Implementation.Log("uppre" + gearItem.name);
            if (gearItem.name == "GEAR_BearSpearStory")
            {
                GameObject gearItemtmp = Resources.Load("GEAR_BearSpear") as GameObject;

                go.GetComponent <GearItem>().m_NarrativeCollectibleItem = gearItemtmp.GetComponent <GearItem>().m_NarrativeCollectibleItem;
                go.GetComponent <GearItem>().m_DegradeOnUse             = gearItemtmp.GetComponent <GearItem>().m_DegradeOnUse;
                go.GetComponent <GearItem>().m_DegradeOnUse.m_DegradeHP = settings.Degrade;
                go.GetComponent <GearItem>().m_Harvest = gearItemtmp.GetComponent <GearItem>().m_Harvest;
                go.GetComponent <GearItem>().m_Harvest.m_YieldGearUnits[0] = 1;                             //head
                go.GetComponent <GearItem>().m_Harvest.m_YieldGearUnits[1] = settings.SpearHarvestSaplings; //sapling
                go.GetComponent <GearItem>().m_AutoEquipOnInteract         = false;

                go.GetComponent <GearItem>().m_WeightKG = settings.Weight;


                // go.GetComponent<GearItem>().name = "GEAR_BearSpearStory";
                // go.GetComponent<GearItem>().m_CurrentHP = gearItem.m_CurrentHP;
            }
            if (gearItem.name == "GEAR_BearSpearBroken")
            {
                go.GetComponent <GearItem>().m_Harvest.m_YieldGearUnits[0] = settings.BrokenSpearHarvestSaplings;                     //sapling
                go.GetComponent <GearItem>().m_Harvest.m_YieldGearUnits[1] = settings.BrokenSpearHarvestScrapmetal;                   //scrap

                // go.GetComponent<GearItem>().name = "GEAR_BearSpearStory";
                // go.GetComponent<GearItem>().m_CurrentHP = gearItem.m_CurrentHP;
            }
        }
        public async Task <GearItemViewModel> AddGearItemAsync(GearItemViewModel gearItemViewModel, CancellationToken ct = default)
        {
            List <GearImageViewModel> gearImages = new List <GearImageViewModel>();
            List <GearSizeViewModel>  gearSizes  = new List <GearSizeViewModel>();

            GearItem newGearItem = new GearItem()
            {
                Name    = gearItemViewModel.Name,
                Price   = gearItemViewModel.Price,
                InStock = gearItemViewModel.InStock
            };

            newGearItem = await _gearItemRepository.AddAsync(newGearItem, ct);

            gearItemViewModel.Id = newGearItem.Id;

            foreach (GearImageViewModel gearImageViewModel in gearItemViewModel.Images)
            {
                gearImageViewModel.GearItemId = gearItemViewModel.Id;

                gearImages.Add(await AddGearImageAsync(gearImageViewModel));
            }

            foreach (GearSizeViewModel gearSizeViewModel in gearItemViewModel.Sizes)
            {
                gearSizeViewModel.GearItemId = gearItemViewModel.Id;

                gearSizes.Add(await AddGearSizeAsync(gearSizeViewModel));
            }

            gearItemViewModel.Images = gearImages;
            gearItemViewModel.Sizes  = gearSizes;

            return(gearItemViewModel);
        }
示例#21
0
        internal static bool Prefix(PlayerManager __instance, GearItem gi)
        {
            if (ModUtils.GetComponent <FirstPersonItem>(gi) != null)
            {
                return(true);
            }

            if (ModUtils.GetEquippableModComponent(gi) == null)
            {
                return(true);
            }

            var currentGi = __instance.m_ItemInHands;

            if (currentGi != null)
            {
                __instance.UnequipItemInHands();
            }

            if (gi != currentGi)
            {
                __instance.EquipItem(gi, false);
            }

            return(false);
        }
示例#22
0
        private static void PostProcess(ModComponent modComponent)
        {
            modComponent.gameObject.layer = vp_Layer.Gear;

            GearItem gearItem = modComponent.GetComponent <GearItem>();

            gearItem.m_SkinnedMeshRenderers = ModUtils.NotNull <SkinnedMeshRenderer>(gearItem.m_SkinnedMeshRenderers);

            GameObject   template     = Resources.Load <GameObject>("GEAR_CoffeeCup");
            MeshRenderer meshRenderer = template.GetComponentInChildren <MeshRenderer>();

            foreach (var eachMeshRenderer in gearItem.m_MeshRenderers)
            {
                foreach (var eachMaterial in eachMeshRenderer.materials)
                {
                    if (eachMaterial.shader.name == "Standard")
                    {
                        eachMaterial.shader         = meshRenderer.material.shader;
                        eachMaterial.shaderKeywords = meshRenderer.material.shaderKeywords;

                        if (eachMaterial.GetTexture("_dmg_texture") is null)
                        {
                            eachMaterial.SetTexture("_dmg_texture", eachMaterial.GetTexture("_MainTex"));
                        }
                    }
                }
            }

            ConsoleWaitlist.MaybeRegisterConsoleGearName(modComponent.GetEffectiveConsoleName(), modComponent.name);

            UnityEngine.Object.DontDestroyOnLoad(modComponent.gameObject);
        }
示例#23
0
        internal static void Postfix(GearItem gi)
        {
            ModClothingComponent modClothingComponent = ModComponentUtils.ComponentUtils.GetComponent <ModClothingComponent>(gi);

            modClothingComponent?.OnTakeOff?.Invoke();
            IntimidationBuffHelper.UpdateWolfIntimidationBuff();
        }
        public S_SPAWN_USER(TeraMessageReader reader) : base(reader)
        {
            reader.Skip(2 + 2 + 2 + 2);
            var nameOffset = reader.ReadUInt16() - 4;

            reader.Skip(2 + 2 + 2 + 2 + 2 + 2 + 2);
            ServerId = reader.ReadUInt32();
            PlayerId = reader.ReadUInt32();
            //if(!WindowManager.GroupWindow.VM.Exists(PlayerId,ServerId)) return;
            EntityId = reader.ReadUInt64();
            reader.Skip(4 + 4 + 4 + 2 + 4 + 4 + 2 + 2 + 2 + 2 + 2 + 1 + 1 + 4 + 4);
            var weaponId = reader.ReadUInt32();
            var armorId  = reader.ReadUInt32();
            var glovesId = reader.ReadUInt32();
            var bootsId  = reader.ReadUInt32();

            Weapon = new GearItem(weaponId, GearTier.Low, GearPiece.Weapon, 0, 0);
            Armor  = new GearItem(armorId, GearTier.Low, GearPiece.Armor, 0, 0);
            Gloves = new GearItem(glovesId, GearTier.Low, GearPiece.Hands, 0, 0);
            Boots  = new GearItem(bootsId, GearTier.Low, GearPiece.Feet, 0, 0);


            reader.Skip(4 + 4 + 4 + 4 + 4 + 4 + 4 + 8 + 4 + 1 + 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4);

            reader.BaseStream.Position = nameOffset;
            Name = reader.ReadTeraString();

            //System.Console.WriteLine("[S_SPAWN_USER] {0} {1}", EntityId, Name);
        }
示例#25
0
 private static void Postfix(GearItem gi)
 {
     if (gi.m_ClothingItem != null && gi.m_ClothingItem.m_Region == ClothingRegion.Feet)
     {
         AnkleSupport.UpdateAnkleSupport();
     }
 }
示例#26
0
        //* Same as games GetBestMatches only reverse.
        internal static GearItem GetWorstMatches(List <GearItemObject> items)
        {
            GearItem matches = null;

            for (int i = 0; i < items.Count; i++)
            {
                GearItem currentMatches = items[i];
                if (currentMatches && currentMatches.m_MatchesItem)
                {
                    if (!Utils.IsZero(currentMatches.m_CurrentHP))
                    {
                        if (!matches)
                        {
                            matches = currentMatches;
                        }
                        // If burntime lower, or burntime the same, but hp lower.
                        else if (currentMatches.m_MatchesItem.m_MaxBurnTimeGametimeSeconds < matches.m_MatchesItem.m_MaxBurnTimeGametimeSeconds ||
                                 (currentMatches.m_MatchesItem.m_MaxBurnTimeGametimeSeconds == matches.m_MatchesItem.m_MaxBurnTimeGametimeSeconds &&
                                  currentMatches.m_CurrentHP < matches.m_CurrentHP))
                        {
                            matches = currentMatches;
                        }
                    }
                }
            }
            return(matches);
        }
示例#27
0
        internal static void applyStats(GearItem gi, bool freeze)
        {
            string guid = Utils.GetGuidFromGameObject(gi.gameObject);

            if (freeze)
            {
                if (isPerishableFood(gi))
                {
                    FoodItem fi = gi.GetComponent <FoodItem>();
                    fi.m_DailyHPDecayInside  = MD[guid].foodDecayIndoor * Settings.options.indoor;
                    fi.m_DailyHPDecayOutside = MD[guid].foodDecayOutdoor * Settings.options.outdoor;
                }
                gi.m_ScentIntensity = MD[guid].scentIntensity * Settings.options.scent;
            }
            else
            {
                if (isPerishableFood(gi))
                {
                    FoodItem fi = gi.GetComponent <FoodItem>();
                    fi.m_DailyHPDecayInside  = MD[guid].foodDecayIndoor;
                    fi.m_DailyHPDecayOutside = MD[guid].foodDecayOutdoor;
                }
                gi.m_ScentIntensity = MD[guid].scentIntensity;
            }
        }
示例#28
0
        internal static bool Prefix(Panel_ActionsRadial __instance, ref List <GearItem> __result)
        {
            __result = new List <GearItem>();

            for (int index = 0; index < GameManager.GetInventoryComponent().m_Items.Count; ++index)
            {
                GearItem component = GameManager.GetInventoryComponent().m_Items[index];
                if (component.m_FoodItem != null && component.m_FoodItem.m_IsDrink)
                {
                    if (component.m_IsInSatchel)
                    {
                        __result.Insert(0, component);
                    }
                    else
                    {
                        __result.Add(component);
                    }
                }

                if (WaterUtils.ContainsWater(component))
                {
                    if (component.m_IsInSatchel)
                    {
                        __result.Insert(0, component);
                    }
                    else
                    {
                        __result.Add(component);
                    }
                }
            }

            return(false);
        }
示例#29
0
        internal static void putBag(GearItem bag)
        {
            string guid = Utils.GetGuidFromGameObject(bag.gameObject);

            if (string.IsNullOrEmpty(guid))
            {
                Utils.SetGuidForGameObject(bag.gameObject, Guid.NewGuid().ToString());
                guid = Utils.GetGuidFromGameObject(bag.gameObject);
            }
            MooseBagData lMBD = new MooseBagData();

            MBD.Add(guid, lMBD);
            MBD[guid].ver       = dataVersion;
            MBD[guid].timestamp = GameManager.GetTimeOfDayComponent().GetTODSeconds(GameManager.GetTimeOfDayComponent().GetSecondsPlayedUnscaled());
            MBD[guid].bagId     = guid;
            MBD[guid].weight    = 0;

            // loop via inventory and add stuff
            Inventory inventoryComponent = GameManager.GetInventoryComponent();

            foreach (GearItemObject item in inventoryComponent.m_Items)
            {
                GearItem gi = item;
                if (gi.name == "GEAR_Gut" || isPerishableFood(gi))
                {
                    addToBag(gi);
                }
            }
        }
示例#30
0
    public virtual bool ShouldSerialize()
    {
        // Should this item be serialized? Generally should only return true if it is dropped on the ground.

        // Do not serialize equipped items.
        if (IsEquipped())
        {
            return(false);
        }

        // Do not serialize gear items if they are equipped.
        GearItem gear = GetComponent <GearItem>();

        if (gear != null)
        {
            if (gear.IsEquipped)
            {
                return(false);
            }
        }

        // Do not serialize attachments if they are currently attached to a weapon.
        Attachment a = GetComponent <Attachment>();

        if (a != null && a.IsAttached)
        {
            return(false);
        }

        return(true);
    }
示例#31
0
 private bool IsEquipped(GearItem gearItem)
 {
     if (gearItem == null)
     {
         return false;
     }
     for (int i = 0; i < (int)GearType.OneAboveMax; i++)
     {
         if (equipped[i] != null && equipped[i].GetType().Equals(gearItem.GetType()))
         {
             return true;
         }
     }
     return false;
 }