Exemple #1
0
    // Token: 0x06001503 RID: 5379 RVA: 0x00076D5C File Offset: 0x00074F5C
    private AvatarDecoratorConfig CreateHolo(IUnityItem holo)
    {
        AvatarDecoratorConfig avatarDecoratorConfig = null;
        GameObject            gameObject            = holo.Create(Vector3.zero, Quaternion.identity);
        HoloGearItem          component             = gameObject.GetComponent <HoloGearItem>();

        if (component && component.Configuration.Ragdoll)
        {
            avatarDecoratorConfig = (UnityEngine.Object.Instantiate(component.Configuration.Ragdoll) as AvatarDecoratorConfig);
            LayerUtil.SetLayerRecursively(avatarDecoratorConfig.transform, UberstrikeLayer.Ragdoll);
            SkinnedMeshCombiner.Combine(avatarDecoratorConfig.gameObject, new List <GameObject>());
        }
        UnityEngine.Object.Destroy(gameObject);
        return(avatarDecoratorConfig);
    }
Exemple #2
0
    // Token: 0x0600188E RID: 6286 RVA: 0x00083E44 File Offset: 0x00082044
    public AvatarGearParts GetRagdollGear()
    {
        AvatarGearParts avatarGearParts = new AvatarGearParts();

        try
        {
            IUnityItem unityItem;
            bool       flag;
            if (this._items.TryGetValue(global::LoadoutSlotType.GearHolo, out unityItem))
            {
                flag = !unityItem.IsLoaded;
                if (unityItem.Prefab)
                {
                    HoloGearItem component = unityItem.Prefab.GetComponent <HoloGearItem>();
                    if (component && component.Configuration.Ragdoll)
                    {
                        avatarGearParts.Base = (UnityEngine.Object.Instantiate(component.Configuration.Ragdoll.gameObject) as GameObject);
                    }
                    else
                    {
                        avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
                    }
                }
                else
                {
                    avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
                }
            }
            else
            {
                flag = true;
                avatarGearParts.Base = (UnityEngine.Object.Instantiate(PrefabManager.Instance.DefaultRagdoll.gameObject) as GameObject);
            }
            if (flag)
            {
                foreach (global::LoadoutSlotType loadoutSlotType in LoadoutManager.GearSlots)
                {
                    if (this._items.TryGetValue(loadoutSlotType, out unityItem))
                    {
                        GameObject gameObject = unityItem.Create(Vector3.zero, Quaternion.identity);
                        if (gameObject)
                        {
                            avatarGearParts.Parts.Add(gameObject);
                        }
                    }
                    else if (Singleton <ItemManager> .Instance.TryGetDefaultItem(ItemUtil.ItemClassFromSlot(loadoutSlotType), out unityItem))
                    {
                        GameObject gameObject2 = unityItem.Create(Vector3.zero, Quaternion.identity);
                        if (gameObject2)
                        {
                            avatarGearParts.Parts.Add(gameObject2);
                        }
                    }
                }
            }
        }
        catch (Exception exception)
        {
            Debug.LogException(exception);
        }
        return(avatarGearParts);
    }
    // Token: 0x060010D0 RID: 4304 RVA: 0x000672C8 File Offset: 0x000654C8
    public GameObject Create(Vector3 position, Quaternion rotation)
    {
        if (UnityItemConfiguration.Instance.IsPrefabAvailable(this.View.PrefabName))
        {
            string prefabPath = UnityItemConfiguration.Instance.GetPrefabPath(this.View.PrefabName);
            Debug.Log(string.Concat(new object[]
            {
                "Create Item:",
                this.View.ID,
                ", ",
                this.View.Name,
                ", ",
                prefabPath
            }));
            UnityEngine.Object @object = Resources.Load <GameObject>(prefabPath);
            this.Prefab = (GameObject)@object;
        }
        else
        {
            Debug.Log(string.Concat(new object[]
            {
                "Create DEFAULT Item:",
                this.View.ID,
                ", ",
                this.View.Name,
                ", ",
                this.View.PrefabName
            }));
            this.Prefab = UnityItemConfiguration.Instance.GetDefaultItem(this.View.ItemClass);
        }
        if (this.View.ItemType == UberstrikeItemType.QuickUse)
        {
            QuickItem component = this.Prefab.GetComponent <QuickItem>();
            if (component != null && component.Sfx)
            {
                Singleton <QuickItemSfxController> .Instance.RegisterQuickItemEffect(component.Logic, component.Sfx);
            }
        }
        GameObject gameObject = null;

        if (this.Prefab != null)
        {
            if (this.View.ItemClass == UberstrikeItemClass.GearHolo)
            {
                HoloGearItem component2 = this.Prefab.GetComponent <HoloGearItem>();
                if (component2 && component2.Configuration.Avatar)
                {
                    gameObject = (UnityEngine.Object.Instantiate(component2.Configuration.Avatar.gameObject) as GameObject);
                }
            }
            else
            {
                gameObject = (UnityEngine.Object.Instantiate(this.Prefab, position, rotation) as GameObject);
            }
            if (gameObject && this.View.ItemType == UberstrikeItemType.Weapon)
            {
                WeaponItem component3 = gameObject.GetComponent <WeaponItem>();
                if (component3)
                {
                    ItemConfigurationUtil.CopyCustomProperties(this.View, component3.Configuration);
                    if (this.View.ItemProperties.ContainsKey(ItemPropertyType.CritDamageBonus))
                    {
                        component3.Configuration.CriticalStrikeBonus = this.View.ItemProperties[ItemPropertyType.CritDamageBonus];
                    }
                    else
                    {
                        component3.Configuration.CriticalStrikeBonus = 0;
                    }
                }
            }
        }
        else
        {
            Debug.LogError("Trying to create item prefab, but it was null. Item Name:" + this.View.Name);
        }
        this.IsLoaded = true;
        return(gameObject);
    }