Exemplo n.º 1
0
    public ParticleSystem SetParticle(EntityClass.ParticleData myParticle)
    {
        Debug.Log("Checking " + myParticle.fileName);
        GameObject temp = DataLoader.LoadAsset <GameObject>(myParticle.fileName);

        if (temp == null)
        {
            Debug.Log("Could not load the particle.");
            return(null);
        }
        Debug.Log("Loaded Game Object");
        GameObject temp2 = UnityEngine.Object.Instantiate <GameObject>(temp);

        if (temp2 == null)
        {
            Debug.Log("Tried to instantiate game object: failed");
            return(null);
        }
        Debug.Log("Searching for particle systems");
        foreach (ParticleSystem particleSystem in temp2.GetComponentsInChildren <ParticleSystem>())
        {
            Debug.Log("particle system: " + particleSystem.name);

            particleSystem.transform.parent = this.emodel.GetModelTransform();

            return(particleSystem);
            //if (myParticle.shapeMesh != null && myParticle.shapeMesh.Length > 0)
            //{
            //    SkinnedMeshRenderer[] componentsInChildren = base.GetComponentsInChildren<SkinnedMeshRenderer>();
            //    ParticleSystem.ShapeModule shape = particleSystem.shape;
            //    shape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer;
            //    string text = myParticle.shapeMesh.ToLower();
            //    if (text.Contains("setshapetomesh"))
            //    {
            //        text = text.Replace("setshapetomesh", string.Empty);
            //        int num = int.Parse(text);
            //        if (num >= 0 && num < componentsInChildren.Length)
            //        {
            //            shape.skinnedMeshRenderer = componentsInChildren[num];
            //            ParticleSystem[] componentsInChildren2 = particleSystem.transform.GetComponentsInChildren<ParticleSystem>();
            //            if (componentsInChildren2 != null)
            //            {
            //                for (int i = 0; i < componentsInChildren2.Length; i++)
            //                {
            //                    shape = componentsInChildren2[i].shape;
            //                    shape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer;
            //                    shape.skinnedMeshRenderer = componentsInChildren[num];
            //                    return componentsInChildren2[i];
            //                }
            //            }
            //        }
            //    }


            //}
        }
        return(null);
    }
Exemplo n.º 2
0
        public override void GetData(object obj)
        {
            var ec = obj as EntityClass;

            if (ec == null)
            {
                return;
            }

            if (IsOption("filter"))
            {
                foreach (var f in StrFilter)
                {
                    switch (f)
                    {
                    case StrFilters.Id:
                        GetId(ec);
                        break;

                    case StrFilters.Name:
                        GetName(ec);
                        break;

                    default:
                        Log.Out($"{Config.ModPrefix} Unknown filter {f}");
                        break;
                    }
                }
            }
            else
            {
                GetId(ec);
                GetName(ec);

                Bin.Add("Class", Class                       = ec.classname?.ToString());
                Bin.Add("Skin", Skin                         = ec.skinTexture);
                Bin.Add("Parent", Parent                     = ec.parentGameObjectName);
                Bin.Add("UserInst", UserInst                 = ec.bAllowUserInstantiate);
                Bin.Add("IsEnemy", IsEnemy                   = ec.bIsEnemyEntity);
                Bin.Add("IsAnimal", IsAnimal                 = ec.bIsAnimalEntity);
                Bin.Add("Explosion", Explosion               = new BCMExplosionData(ec.explosionData));
                Bin.Add("Model", Model                       = ec.modelType);
                Bin.Add("ModelP1", ModelP1                   = ec.modelTypeParams1);
                Bin.Add("ModelP2", ModelP2                   = ec.modelTypeParams2);
                Bin.Add("RagdollChance", RagdollChance       = Math.Round(ec.RagdollOnDeathChance, 6));
                Bin.Add("HasRagdoll", HasRagdoll             = ec.HasRagdoll);
                Bin.Add("Colliders", Colliders               = ec.CollidersRagdollAsset);
                Bin.Add("CrouchY", CrouchY                   = Math.Round(ec.crouchYOffsetFP, 6));
                Bin.Add("CorpseId", CorpseId                 = ec.CorpseBlockId);
                Bin.Add("CorpseChance", CorpseChance         = Math.Round(ec.CorpseBlockChance, 6));
                Bin.Add("CorpseDen", CorpseDen               = ec.CorpseBlockDensity);
                Bin.Add("MaxTurn", MaxTurn                   = Math.Round(ec.MaxTurnSpeed, 6));
                Bin.Add("RootMotion", RootMotion             = ec.RootMotion);
                Bin.Add("HasDeathAnim", HasDeathAnim         = ec.HasDeathAnim);
                Bin.Add("IsMale", IsMale                     = ec.bIsMale);
                Bin.Add("IsObserver", IsObserver             = ec.bIsChunkObserver);
                Bin.Add("Experience", Experience             = ec.ExperienceValue);
                Bin.Add("Physics", Physics                   = ec.PhysicsBody?.Name);
                Bin.Add("DeadHP", DeadHP                     = ec.DeadBodyHitPoints);
                Bin.Add("LegCrippleTh", LegCrippleTh         = Math.Round(ec.LegCrippleThreshold, 6));
                Bin.Add("LegCrawlerTh", LegCrawlerTh         = Math.Round(ec.LegCrawlerThreshold, 6));
                Bin.Add("LowerLegDisTh", LowerLegDisTh       = Math.Round(ec.LowerLegDismemberThreshold, 6));
                Bin.Add("LowerLegDisBonus", LowerLegDisBonus = Math.Round(ec.LowerLegDismemberBonusChance, 6));
                Bin.Add("LowerLegDisBase", LowerLegDisBase   = Math.Round(ec.LowerLegDismemberBaseChance, 6));
                Bin.Add("UpperLegDisTh", UpperLegDisTh       = Math.Round(ec.UpperLegDismemberThreshold, 6));
                Bin.Add("UpperLegDisBonus", UpperLegDisBonus = Math.Round(ec.UpperLegDismemberBonusChance, 6));
                Bin.Add("UpperLegDisBase", UpperLegDisBase   = Math.Round(ec.UpperLegDismemberBaseChance, 6));
                Bin.Add("LowerArmDisTh", LowerArmDisTh       = Math.Round(ec.LowerArmDismemberThreshold, 6));
                Bin.Add("LowerArmDisBonus", LowerArmDisBonus = Math.Round(ec.LowerArmDismemberBonusChance, 6));
                Bin.Add("LowerArmDisBase", LowerArmDisBase   = Math.Round(ec.LowerArmDismemberBaseChance, 6));
                Bin.Add("UpperArmDisTh", UpperArmDisTh       = Math.Round(ec.UpperArmDismemberThreshold, 6));
                Bin.Add("UpperArmDisBonus", UpperArmDisBonus = Math.Round(ec.UpperArmDismemberBonusChance, 6));
                Bin.Add("UpperArmDisBase", UpperArmDisBase   = Math.Round(ec.UpperArmDismemberBaseChance, 6));
                Bin.Add("HeadDisTh", HeadDisTh               = Math.Round(ec.HeadDismemberThreshold, 6));
                Bin.Add("HeadDisBase", HeadDisBase           = Math.Round(ec.HeadDismemberBaseChance, 6));
                Bin.Add("HeadDisBonus", HeadDisBonus         = Math.Round(ec.HeadDismemberBonusChance, 6));
                Bin.Add("KDKneelDamTh", KDKneelDamTh         = Math.Round(ec.KnockdownKneelDamageThreshold, 6));
                Bin.Add("LegsExpMult", LegsExpMult           = Math.Round(ec.LegsExplosionDamageMultiplier, 6));
                Bin.Add("ArmsExpMult", ArmsExpMult           = Math.Round(ec.ArmsExplosionDamageMultiplier, 6));
                Bin.Add("ChestExpMult", ChestExpMult         = Math.Round(ec.ChestExplosionDamageMultiplier, 6));
                Bin.Add("HeadExpMult", HeadExpMult           = Math.Round(ec.HeadExplosionDamageMultiplier, 6));
                Bin.Add("SearchArea", SearchArea             = Math.Round(ec.SearchArea, 6));
                Bin.Add("SwimOffset", SwimOffset             = Math.Round(ec.SwimOffset, 6));
                Bin.Add("SightRange", SightRange             = Math.Round(ec.SightRange, 6));
                Bin.Add("GroanMin", GroanMin                 = new BCMVector2(ec.GroanMin));
                Bin.Add("GroanMax", GroanMax                 = new BCMVector2(ec.GroanMax));
                Bin.Add("WakeMin", WakeMin                   = new BCMVector2(ec.WakeMin));
                Bin.Add("WakeMax", WakeMax                   = new BCMVector2(ec.WakeMax));
                Bin.Add("SightScale", SightScale             = new BCMVector2(ec.SightScale));
                Bin.Add("SmellAlert", SmellAlert             = new BCMVector2(ec.SmellAlert));
                Bin.Add("NoiseAlert", NoiseAlert             = new BCMVector2(ec.NoiseAlert));
                Bin.Add("SmellWake", SmellWake               = new BCMVector2(ec.SmellWake));
                Bin.Add("SmellGroan", SmellGroan             = new BCMVector2(ec.SmellGroan));
                Bin.Add("NoiseWake", NoiseWake               = new BCMVector2(ec.NoiseWake));
                Bin.Add("NoiseGroan", NoiseGroan             = new BCMVector2(ec.NoiseGroan));
                Bin.Add("GroanChance", GroanChance           = Math.Round(ec.GroanChance, 6));
                Bin.Add("UMARace", UMARace                   = ec.UMARace);
                Bin.Add("UMAGenModel", UMAGenModel           = ec.UMAGeneratedModelName);
                Bin.Add("MatSwap", MatSwap                   = ec.MaterialSwap?.ToList());
                if (ec.tintColors != null)
                {
                    foreach (var tint in ec.tintColors.Values)
                    {
                        Tints.Add(new BCMVector3(tint));
                    }
                }
                Bin.Add("Tints", Tints);
                Bin.Add("SpawnParticle", SpawnParticle               = ec.particleOnSpawn);
                Bin.Add("KDKneelStunDur", KDKneelStunDur             = new BCMVector2(ec.KnockdownProneStunDuration));
                Bin.Add("KDProneDamTh", KDProneDamTh                 = Math.Round(ec.KnockdownProneDamageThreshold, 6));
                Bin.Add("KDProneStunDur", KDProneStunDur             = new BCMVector2(ec.KnockdownProneStunDuration));
                Bin.Add("KDProneRefillRate", KDProneRefillRate       = new BCMVector2(ec.KnockdownProneRefillRate));
                Bin.Add("KDKneelRefillRate", KDKneelRefillRate       = new BCMVector2(ec.KnockdownKneelRefillRate));
                Bin.Add("ModelTransformAdjust", ModelTransformAdjust = new BCMVector3(ec.ModelTransformAdjust));
                Bin.Add("Archetype", Archetype           = ec.ArchetypeName);
                Bin.Add("AIPackages", AIPackages         = ec.AIPackages?.ToList());
                Bin.Add("UseAIPackages", UseAIPackages   = ec.UseAIPackages);
                Bin.Add("PainStates", PainStates         = ec.MechanimPainStates);
                Bin.Add("PainTriggers", PainTriggers     = ec.MechanimPainTriggers);
                Bin.Add("Attacks", Attacks               = ec.MechanimAttacks);
                Bin.Add("AttackTriggers", AttackTriggers = ec.MechanimAttackTriggers);
                Bin.Add("SpecialAttacks", SpecialAttacks = ec.MechanimSpecialAttacks);
                Bin.Add("SpecialAttackTriggers", SpecialAttackTriggers = ec.MechanimSpecialAttackTriggers);
                Bin.Add("DeathStates", DeathStates = ec.MechanimDeathStates);
                Bin.Add("DeathStateTriggers", DeathStateTriggers = ec.MechanimDeathStateTriggers);
                Bin.Add("Buffs", Buffs = ec.Buffs);
            }
        }