示例#1
0
 public override void Attached()
 {
     if (!base.entity.isOwner)
     {
         CoopMutantDummyToken coopMutantDummyToken = base.entity.attachToken as CoopMutantDummyToken;
         CoopRagdollToken     coopRagdollToken     = base.entity.attachToken as CoopRagdollToken;
         if (coopRagdollToken != null && coopRagdollToken.onFireApplied)
         {
             doBurn component = base.transform.GetComponent <doBurn>();
             if (component && component.fire)
             {
                 component.fire.SetActive(true);
             }
         }
         if (coopMutantDummyToken != null)
         {
             animalSkinSetup component2 = base.transform.GetComponent <animalSkinSetup>();
             if (component2)
             {
                 MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
                 component2.skin.GetPropertyBlock(materialPropertyBlock);
                 materialPropertyBlock.SetFloat("_Damage1", coopMutantDummyToken.skinDamage1);
                 materialPropertyBlock.SetFloat("_Damage2", coopMutantDummyToken.skinDamage2);
                 materialPropertyBlock.SetFloat("_Damage3", coopMutantDummyToken.skinDamage3);
                 materialPropertyBlock.SetFloat("_Damage4", coopMutantDummyToken.skinDamage4);
                 component2.skin.SetPropertyBlock(materialPropertyBlock);
             }
         }
     }
 }
示例#2
0
    public void goRagdoll()
    {
        if (this.ragdollSpawned)
        {
            return;
        }
        this.ragdollSpawned = true;
        Transform transform = this.ragdoll.metgoragdoll(default(Vector3));

        if (PoolManager.Pools["creatures"].IsSpawned(this.rootTr))
        {
            this.spawnFunctions.despawn();
        }
        else
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }
        CoopMutantDummyToken  coopMutantDummyToken  = new CoopMutantDummyToken();
        MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();

        this.skinRenderer.GetPropertyBlock(materialPropertyBlock);
        coopMutantDummyToken.skinDamage1 = materialPropertyBlock.GetFloat("_Damage1");
        coopMutantDummyToken.skinDamage2 = materialPropertyBlock.GetFloat("_Damage2");
        coopMutantDummyToken.skinDamage3 = materialPropertyBlock.GetFloat("_Damage3");
        coopMutantDummyToken.skinDamage4 = materialPropertyBlock.GetFloat("_Damage4");
        if (BoltNetwork.isRunning)
        {
            BoltNetwork.Attach(transform.gameObject, coopMutantDummyToken);
        }
    }
示例#3
0
    public Transform metgoragdoll(Vector3 varpvelocity = default(Vector3))
    {
        Transform transform = UnityEngine.Object.Instantiate(this.vargamragdoll, base.transform.position, base.transform.rotation) as Transform;

        transform.localScale = base.transform.localScale;
        this.metcopytransforms(base.transform, transform, varpvelocity * 1f);
        if (this.doCreepySkin)
        {
            transform.gameObject.SendMessage("setSkin", this.health.MySkin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
            this.health.MySkin.GetPropertyBlock(this.bloodPropertyBlock);
            transform.gameObject.SendMessage("setSkinDamageProperty", this.bloodPropertyBlock, SendMessageOptions.DontRequireReceiver);
            if (BoltNetwork.isServer)
            {
                IMutantState         state = base.transform.parent.GetComponent <BoltEntity>().GetState <IMutantState>();
                CoopMutantDummyToken coopMutantDummyToken = new CoopMutantDummyToken();
                coopMutantDummyToken.Scale       = base.transform.localScale;
                coopMutantDummyToken.skinDamage1 = this.bloodPropertyBlock.GetFloat("_Damage1");
                coopMutantDummyToken.skinDamage2 = this.bloodPropertyBlock.GetFloat("_Damage2");
                coopMutantDummyToken.skinDamage3 = this.bloodPropertyBlock.GetFloat("_Damage3");
                coopMutantDummyToken.skinDamage4 = this.bloodPropertyBlock.GetFloat("_Damage4");
                mutantTypeSetup component = base.transform.parent.GetComponent <mutantTypeSetup>();
                if (component)
                {
                    coopMutantDummyToken.storedRagDollName = component.storedRagDollName;
                }
                BoltNetwork.Attach(transform.gameObject, coopMutantDummyToken);
            }
        }
        if (this.animal)
        {
            animalSpawnFunctions component2 = base.transform.root.GetComponent <animalSpawnFunctions>();
            if (component2)
            {
                transform.gameObject.SendMessage("setSkin", component2.meshRenderer.sharedMaterial, SendMessageOptions.DontRequireReceiver);
            }
        }
        if (this.bird)
        {
            lb_Bird component3 = base.transform.GetComponent <lb_Bird>();
            transform.gameObject.SendMessage("setSkin", component3.skin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
        }
        if (this.fish)
        {
            transform.gameObject.SendMessage("doSkinSetup", this.fishScript.fishTypeInt, SendMessageOptions.DontRequireReceiver);
        }
        if (this.burning)
        {
            transform.gameObject.SendMessage("enableFire", SendMessageOptions.DontRequireReceiver);
        }
        if (this.alreadyBurnt)
        {
            transform.gameObject.SendMessage("enableBurntSkin", SendMessageOptions.DontRequireReceiver);
        }
        this.burning      = false;
        this.alreadyBurnt = false;
        return(transform);
    }
示例#4
0
 public Transform metgoragdoll(Vector3 varpvelocity = default(Vector3))
 {
     Transform transform = UnityEngine.Object.Instantiate(this.vargamragdoll, base.transform.position, base.transform.rotation) as Transform;
     transform.localScale = base.transform.localScale;
     this.metcopytransforms(base.transform, transform, varpvelocity * 1f);
     if (this.doCreepySkin)
     {
         transform.gameObject.SendMessage("setSkin", this.health.MySkin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
         this.health.MySkin.GetPropertyBlock(this.bloodPropertyBlock);
         transform.gameObject.SendMessage("setSkinDamageProperty", this.bloodPropertyBlock, SendMessageOptions.DontRequireReceiver);
         if (BoltNetwork.isServer)
         {
             IMutantState state = base.transform.parent.GetComponent<BoltEntity>().GetState<IMutantState>();
             CoopMutantDummyToken coopMutantDummyToken = new CoopMutantDummyToken();
             coopMutantDummyToken.Scale = base.transform.localScale;
             coopMutantDummyToken.skinDamage1 = this.bloodPropertyBlock.GetFloat("_Damage1");
             coopMutantDummyToken.skinDamage2 = this.bloodPropertyBlock.GetFloat("_Damage2");
             coopMutantDummyToken.skinDamage3 = this.bloodPropertyBlock.GetFloat("_Damage3");
             coopMutantDummyToken.skinDamage4 = this.bloodPropertyBlock.GetFloat("_Damage4");
             mutantTypeSetup component = base.transform.parent.GetComponent<mutantTypeSetup>();
             if (component)
             {
                 coopMutantDummyToken.storedRagDollName = component.storedRagDollName;
             }
             BoltNetwork.Attach(transform.gameObject, coopMutantDummyToken);
         }
     }
     if (this.animal)
     {
         animalSpawnFunctions component2 = base.transform.root.GetComponent<animalSpawnFunctions>();
         if (component2)
         {
             transform.gameObject.SendMessage("setSkin", component2.meshRenderer.sharedMaterial, SendMessageOptions.DontRequireReceiver);
         }
     }
     if (this.bird)
     {
         lb_Bird component3 = base.transform.GetComponent<lb_Bird>();
         transform.gameObject.SendMessage("setSkin", component3.skin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
     }
     if (this.fish)
     {
         transform.gameObject.SendMessage("doSkinSetup", this.fishScript.fishTypeInt, SendMessageOptions.DontRequireReceiver);
     }
     if (this.burning)
     {
         transform.gameObject.SendMessage("enableFire", SendMessageOptions.DontRequireReceiver);
     }
     if (this.alreadyBurnt)
     {
         transform.gameObject.SendMessage("enableBurntSkin", SendMessageOptions.DontRequireReceiver);
     }
     this.burning = false;
     this.alreadyBurnt = false;
     return transform;
 }
 public override void Attached()
 {
     if (!this.entity.IsOwner())
     {
         base.state.AddCallback("MainMaterialIndex", new PropertyCallback(this.OnMainMaterialIndexChanged));
         this.token = (this.entity.attachToken as CoopMutantDummyToken);
         if (this.token != null && !this.ignoreScale)
         {
             base.transform.localScale = this.token.Scale;
         }
     }
     base.Invoke("resetSkinDamage", 0.5f);
     if (this.dummyDamageSync && BoltNetwork.isRunning)
     {
         this.setSkinDamage();
     }
 }
示例#6
0
    public Transform metgoragdoll(Vector3 varpvelocity = default(Vector3))
    {
        Transform transform = UnityEngine.Object.Instantiate <Transform>(this.vargamragdoll, base.transform.position, base.transform.rotation);

        if (!this.ignoreScale)
        {
            transform.localScale = base.transform.localScale;
        }
        this.metcopytransforms(base.transform, transform, varpvelocity * 1f);
        if (this.doCreepySkin && this.enemyHealth)
        {
            transform.gameObject.SendMessage("setSkin", this.enemyHealth.MySkin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
            this.enemyHealth.MySkin.GetPropertyBlock(this.bloodPropertyBlock);
            transform.gameObject.SendMessage("setSkinDamageProperty", this.bloodPropertyBlock, SendMessageOptions.DontRequireReceiver);
            if (this.enemyHealth.Fire.Length > 0)
            {
                mutantTransferFire component = base.transform.parent.GetComponent <mutantTransferFire>();
                foreach (GameObject gameObject in this.enemyHealth.Fire)
                {
                    if (gameObject.activeSelf && component)
                    {
                        component.transferFireToTarget(gameObject, transform.gameObject);
                    }
                }
            }
            if (BoltNetwork.isServer)
            {
                BoltEntity component2 = base.transform.parent.GetComponent <BoltEntity>();
                if (component2)
                {
                    IMutantState         state = component2.GetState <IMutantState>();
                    CoopMutantDummyToken coopMutantDummyToken = new CoopMutantDummyToken();
                    coopMutantDummyToken.Scale       = base.transform.localScale;
                    coopMutantDummyToken.skinDamage1 = this.bloodPropertyBlock.GetFloat("_Damage1");
                    coopMutantDummyToken.skinDamage2 = this.bloodPropertyBlock.GetFloat("_Damage2");
                    coopMutantDummyToken.skinDamage3 = this.bloodPropertyBlock.GetFloat("_Damage3");
                    coopMutantDummyToken.skinDamage4 = this.bloodPropertyBlock.GetFloat("_Damage4");
                    coopMutantDummyToken.skinColor   = this.enemyHealth.MySkin.sharedMaterial.GetColor("_Color");
                    mutantTypeSetup component3 = base.transform.parent.GetComponent <mutantTypeSetup>();
                    if (component3)
                    {
                    }
                    BoltNetwork.Attach(transform.gameObject, coopMutantDummyToken);
                }
            }
        }
        if (this.animalHealth && this.animalHealth.mySkin)
        {
            this.animalHealth.mySkin.GetPropertyBlock(this.bloodPropertyBlock);
            float @float = this.bloodPropertyBlock.GetFloat("_Damage1");
            transform.gameObject.SendMessage("setSkinDamageProperty", this.bloodPropertyBlock, SendMessageOptions.DontRequireReceiver);
        }
        if (this.animalHealth && this.animalHealth.Fire)
        {
            mutantTransferFire component4;
            if (base.transform.parent)
            {
                component4 = base.transform.parent.GetComponent <mutantTransferFire>();
            }
            else
            {
                component4 = base.transform.GetComponent <mutantTransferFire>();
            }
            if (this.animalHealth.Fire.activeSelf && component4)
            {
                component4.transferFireToTarget(this.animalHealth.Fire, transform.gameObject);
            }
        }
        if (this.bat && this.burning)
        {
            transform.gameObject.SendMessage("enableFire", SendMessageOptions.DontRequireReceiver);
        }
        if (this.animal)
        {
            animalSpawnFunctions component5 = base.transform.root.GetComponent <animalSpawnFunctions>();
            if (component5)
            {
                transform.gameObject.SendMessage("setSkin", component5.meshRenderer.sharedMaterial, SendMessageOptions.DontRequireReceiver);
            }
            if (this.ca && this.ca.isSnow)
            {
                transform.gameObject.SendMessage("setupSnowRabbitTypeTrigger", SendMessageOptions.DontRequireReceiver);
            }
        }
        if (this.bird)
        {
            if (this.burning)
            {
                transform.gameObject.SendMessage("enableFire", SendMessageOptions.DontRequireReceiver);
            }
            lb_Bird component6 = base.transform.GetComponent <lb_Bird>();
            transform.gameObject.SendMessage("setSkin", component6.skin.sharedMaterial, SendMessageOptions.DontRequireReceiver);
        }
        if (this.fish)
        {
            transform.gameObject.SendMessage("doSkinSetup", this.fishScript.fishTypeInt, SendMessageOptions.DontRequireReceiver);
            transform.gameObject.SendMessage("setupFishType", this.fishScript.fishNatureGuideValue, SendMessageOptions.DontRequireReceiver);
        }
        if (this.alreadyBurnt)
        {
            transform.gameObject.SendMessage("enableBurntSkin", SendMessageOptions.DontRequireReceiver);
        }
        if (this.ast)
        {
            arrowStickToTarget component7 = transform.GetComponent <arrowStickToTarget>();
            if (component7)
            {
                int num = 0;
                foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows)
                {
                    if (keyValuePair.Key)
                    {
                        component7.CreatureType(this.ast.IsAnimal, this.ast.IsBird, this.ast.IsFish);
                        int arrowType = 0;
                        if (num < this.ast.stuckArrowsTypeList.Count)
                        {
                            arrowType = this.ast.stuckArrowsTypeList[num];
                        }
                        component7.applyStuckArrowToDummy(keyValuePair.Key, keyValuePair.Key.localPosition, keyValuePair.Key.localRotation, keyValuePair.Value, arrowType);
                        num++;
                    }
                }
            }
        }
        this.burning      = false;
        this.alreadyBurnt = false;
        return(transform);
    }
示例#7
0
    public IEnumerator spawnDummy(getAnimatorParams.DummyParams p)
    {
        Quaternion angle = p.Angle;

        if (BoltNetwork.isClient)
        {
            yield break;
        }
        Vector3 bodyPosition    = base.transform.position;
        bool    useBodyPosition = false;

        if (this.setup && this.setup.ai && this.setup.ai.pale && !p.IsDummyLoad && this.health.trapGo)
        {
            trapTrigger componentInChildren = this.health.trapGo.GetComponentInChildren <trapTrigger>();
            if (componentInChildren)
            {
                componentInChildren.FixPalePosition(this.setup, false);
                bodyPosition   += -0.15f * Vector3.up;
                useBodyPosition = true;
            }
        }
        GameObject dummy = UnityEngine.Object.Instantiate <GameObject>(this.dummyMutant, bodyPosition, base.transform.rotation);

        dummy.transform.rotation = angle;
        if (p.IsDummyLoad || (this.animator.GetBool("trapBool") && this.animator.GetInteger("trapTypeInt1") == 2))
        {
            dummy.transform.localEulerAngles = new Vector3(0f, dummy.transform.localEulerAngles.y, 0f);
        }
        dummy.transform.localScale = this.mutantBase.localScale;
        dummy.SendMessage("setCalledFromDeath", SendMessageOptions.DontRequireReceiver);
        SkinnedMeshRenderer[] sk = dummy.GetComponentsInChildren <SkinnedMeshRenderer>();
        foreach (SkinnedMeshRenderer skinnedMeshRenderer in sk)
        {
            skinnedMeshRenderer.enabled = false;
        }
        Animator          dummyAnim = dummy.GetComponent <Animator>();
        AnimatorStateInfo state     = this.animator.GetCurrentAnimatorStateInfo(0);

        dummyAnim.CrossFade(state.nameHash, 0f, 0, state.normalizedTime);
        dummyAnim.CopyParamsFrom(this.animator);
        if (p.IsDummyLoad)
        {
            if (this.animator.GetInteger("trapTypeInt1") != 3)
            {
                dummyAnim.SetBoolReflected("trapBool", true);
                if (this.animator.GetInteger("trapTypeInt1") == 2)
                {
                    dummyAnim.SetBoolReflected("enterTrapBool", true);
                    dummyAnim.SetBoolReflected("deathBOOL", true);
                }
                else
                {
                    dummyAnim.SetTriggerReflected("deathTrigger");
                }
            }
        }
        this.dummyHips.rotation    = this.hips.rotation;
        this.dummyHips.position    = bodyPosition;
        dummy.transform.position   = bodyPosition;
        dummy.transform.localScale = this.mutantBase.localScale;
        if (this.setup.health.Fire.Length > 0)
        {
            mutantTransferFire component = base.transform.GetComponent <mutantTransferFire>();
            foreach (GameObject gameObject in this.setup.health.Fire)
            {
                if (gameObject.activeSelf)
                {
                    component.transferFireToTarget(gameObject, dummy);
                }
            }
        }
        if (p.IsDummyLoad || this.animator.GetBool("trapBool"))
        {
            if (this.animator.GetInteger("trapTypeInt1") == 2 && this.health.trapParent)
            {
                dummy.transform.parent = this.health.trapParent.transform;
                dummy.SendMessageUpwards("setTrapDummy", dummy);
                CoopMutantDummy componentInChildren2 = dummy.GetComponentInChildren <CoopMutantDummy>();
                if (componentInChildren2 && this.health.trapGo)
                {
                    this.health.trapGo.SendMessage("SetNooseRope", componentInChildren2, SendMessageOptions.DontRequireReceiver);
                }
            }
            if ((p.IsDummyLoad || this.animator.GetInteger("trapTypeInt1") == 0) && this.health.trapGo)
            {
                this.health.trapGo.SendMessage("addTrappedMutant", new object[]
                {
                    dummy,
                    this.setup
                }, SendMessageOptions.DontRequireReceiver);
                dummy.SendMessage("setTrapGo", this.health.trapGo, SendMessageOptions.DontRequireReceiver);
            }
        }
        string TYPE   = string.Empty;
        bool   skinny = false;

        dummy.SendMessage("invokePickupSpawn", SendMessageOptions.DontRequireReceiver);
        if (this.setup.ai.femaleSkinny)
        {
            skinny = true;
            dummy.SendMessage(TYPE = "setFemaleSkinny", base.transform);
        }
        if (this.setup.ai.maleSkinny)
        {
            skinny = true;
            if (this.setup.ai.pale)
            {
                dummy.SendMessage(TYPE = "enableMaleSkinnyPaleProps");
                dummy.SendMessage(TYPE = "setMaleSkinnyPale", base.transform);
                if (this.setup.ai.skinned)
                {
                    dummy.SendMessage(TYPE = "setSkinnedMutant", this.setup.ai.skinned);
                }
            }
            else
            {
                dummy.SendMessage(TYPE = "enableMaleSkinnyProps");
                dummy.SendMessage(TYPE = "setMaleSkinny", base.transform);
            }
        }
        if (this.setup.ai.pale && !this.setup.ai.maleSkinny)
        {
            dummy.SendMessage(TYPE = "enablePaleProps");
            dummy.SendMessage(TYPE = "setPaleMale");
            if (this.setup.ai.skinned)
            {
                dummy.SendMessage(TYPE = "setSkinnedMutant", this.setup.ai.skinned);
            }
        }
        if (this.setup.ai.leader && !this.setup.ai.maleSkinny && !this.setup.ai.pale && !this.setup.ai.female)
        {
            dummy.SendMessage(TYPE = "setRegularMale", this.setup.propManager ? this.setup.propManager.regularMaleDice : 0);
            dummy.SendMessage(TYPE = "enableLeaderProps", this.setup.propManager ? this.setup.propManager.LeaderDice : 0);
            if (this.setup.ai.painted)
            {
                dummy.SendMessage(TYPE = "setPaintedLeader");
            }
            dummy.SendMessage(TYPE = "setRegularMaleLeader");
        }
        if (this.setup.ai.fireman)
        {
            if (this.setup.ai.fireman_dynamite)
            {
                dummy.SendMessage(TYPE = "setDynamiteMan");
            }
            dummy.SendMessage(TYPE = "enableFiremanProps");
            dummy.SendMessage(TYPE = "setRegularMaleFireman");
        }
        if (this.setup.ai.female && !this.setup.ai.femaleSkinny)
        {
            if (this.setup.ai.painted)
            {
                dummy.SendMessage(TYPE = "setFemalePainted", this.setup.bodyVariation ? this.setup.bodyVariation.femaleDice : 0);
            }
            else
            {
                dummy.SendMessage(TYPE = "setFemaleRegular", this.setup.bodyVariation ? this.setup.bodyVariation.femaleDice : 0);
            }
            if (this.bodyVar && this.bodyVar.Hair && this.bodyVar.Hair.activeSelf)
            {
                dummy.SendMessage(TYPE = "setFemaleHair");
            }
            if (this.bodyVar && this.bodyVar.Clothing && this.bodyVar.Clothing.activeSelf)
            {
                dummy.SendMessage(TYPE = "setFemaleClothes");
            }
            if (this.bodyVar && this.bodyVar.FireDice == 2)
            {
                dummy.SendMessage(TYPE = "setFemaleFire");
            }
        }
        if (this.setup.ai.male && !this.setup.ai.maleSkinny && !this.setup.ai.pale && !this.setup.ai.fireman && !this.setup.ai.leader)
        {
            if (this.setup.ai.painted)
            {
                dummy.SendMessage(TYPE = "setPaintedMale", this.setup.propManager ? this.setup.propManager.regularMaleDice : 0);
            }
            else
            {
                dummy.SendMessage(TYPE = "setRegularMale", this.setup.propManager ? this.setup.propManager.regularMaleDice : 0);
            }
        }
        if (this.setup.health.alreadyBurnt)
        {
            dummy.SendMessage("setBurntSkin", SendMessageOptions.DontRequireReceiver);
        }
        dummy.SendMessage("setPoisoned", this.health.poisoned, SendMessageOptions.DontRequireReceiver);
        if (this.setup.arrowSticker)
        {
            arrowStickToTarget componentInChildren3 = dummy.GetComponentInChildren <arrowStickToTarget>();
            foreach (KeyValuePair <Transform, int> keyValuePair in this.setup.arrowSticker.stuckArrows)
            {
                if (keyValuePair.Key)
                {
                    componentInChildren3.applyStuckArrowToDummy(keyValuePair.Key, keyValuePair.Key.localPosition, keyValuePair.Key.localRotation, keyValuePair.Value);
                }
            }
        }
        this.setup.health.MySkin.GetPropertyBlock(this.bloodPropertyBlock);
        dummy.SendMessage("setSkinDamageProperty", this.bloodPropertyBlock, SendMessageOptions.DontRequireReceiver);
        dummy.SendMessage("setSkinMaterialProperties", this.health.MySkin.material, SendMessageOptions.DontRequireReceiver);
        if (BoltNetwork.isServer)
        {
            CoopMutantDummyToken coopMutantDummyToken = new CoopMutantDummyToken();
            coopMutantDummyToken.Skinny         = skinny;
            coopMutantDummyToken.HipPosition    = bodyPosition;
            coopMutantDummyToken.HipRotation    = this.hips.rotation;
            coopMutantDummyToken.OriginalMutant = base.GetComponent <BoltEntity>();
            coopMutantDummyToken.Scale          = this.mutantBase.localScale;
            coopMutantDummyToken.skinDamage1    = this.bloodPropertyBlock.GetFloat("_Damage1");
            coopMutantDummyToken.skinDamage2    = this.bloodPropertyBlock.GetFloat("_Damage2");
            coopMutantDummyToken.skinDamage3    = this.bloodPropertyBlock.GetFloat("_Damage3");
            coopMutantDummyToken.skinDamage4    = this.bloodPropertyBlock.GetFloat("_Damage4");
            if (p.IsDummyLoad)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer2 in sk)
                {
                    skinnedMeshRenderer2.enabled = true;
                }
                CoopMutantMaterialSync component2 = dummy.GetComponent <CoopMutantMaterialSync>();
                component2.ForceStart();
                coopMutantDummyToken.MaterialIndex = component2.GetMaterialIndex();
                CoopMutantPropSync component3 = dummy.GetComponent <CoopMutantPropSync>();
                coopMutantDummyToken.Props = component3.GetPropMask();
            }
            else
            {
                IMutantState state2 = base.GetComponent <BoltEntity>().GetState <IMutantState>();
                coopMutantDummyToken.MaterialIndex = state2.MainMaterialIndex;
                coopMutantDummyToken.Props         = state2.prop_mask;
            }
            if (this.health.poisoned)
            {
                coopMutantDummyToken.skinColor = new Color(0.670588255f, 0.796078444f, 0.5529412f, 1f);
            }
            else if (this.setup.ai.pale && !this.setup.ai.skinned)
            {
                coopMutantDummyToken.skinColor = new Color(0.8039216f, 0.870588243f, 0.9137255f, 1f);
            }
            else
            {
                coopMutantDummyToken.skinColor = new Color(0.698039234f, 0.698039234f, 0.698039234f, 1f);
            }
            BoltNetwork.Attach(dummy, coopMutantDummyToken);
        }
        if (BoltNetwork.isServer)
        {
            IMutantFemaleDummyState mutantFemaleDummyState;
            if (dummy.GetComponent <BoltEntity>().TryFindState <IMutantFemaleDummyState>(out mutantFemaleDummyState))
            {
                mutantFemaleDummyState.Type          = TYPE;
                mutantFemaleDummyState.CrossFadeHash = state.nameHash;
                mutantFemaleDummyState.CrossFadeTime = state.normalizedTime;
            }
            IMutantMaleDummyState mutantMaleDummyState;
            if (dummy.GetComponent <BoltEntity>().TryFindState <IMutantMaleDummyState>(out mutantMaleDummyState))
            {
                mutantMaleDummyState.Type          = TYPE;
                mutantMaleDummyState.CrossFadeHash = state.nameHash;
                mutantMaleDummyState.CrossFadeTime = state.normalizedTime;
            }
        }
        List <Quaternion> jointRotations = new List <Quaternion>();

        for (int l = 0; l < this.mrs.jointsToSync.Length; l++)
        {
            jointRotations.Add(this.mrs.jointsToSync[l].localRotation);
        }
        if (!p.IsDummyLoad && !this.animator.GetBool("trapBool"))
        {
            dummy.SendMessage("syncRagDollJoints", jointRotations, SendMessageOptions.DontRequireReceiver);
        }
        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        dummy.transform.localScale = this.mutantBase.localScale;
        dummy.transform.position   = ((!useBodyPosition) ? this.DeadPosition : bodyPosition);
        if (this.animator.GetBool("trapBool") && this.animator.GetInteger("trapTypeInt1") == 2)
        {
            this.setup.rootTr.parent = null;
        }
        foreach (SkinnedMeshRenderer skinnedMeshRenderer3 in sk)
        {
            skinnedMeshRenderer3.enabled = true;
        }
        if (PoolManager.Pools["enemies"].IsSpawned(base.transform))
        {
            PoolManager.Pools["enemies"].Despawn(base.transform);
        }
        else if (BoltNetwork.isServer)
        {
            dummy.GetComponent <BoltEntity>().DestroyDelayed(0.1f);
        }
        else
        {
            UnityEngine.Object.Destroy(base.transform.gameObject);
        }
        yield return(null);

        yield break;
    }
示例#8
0
 public override void Attached()
 {
     if (!this.Creepy)
     {
         base.state.Transform.SetTransforms(base.transform);
     }
     if (!base.entity.isOwner)
     {
         CoopMutantDummyToken coopMutantDummyToken = base.entity.attachToken as CoopMutantDummyToken;
         if (coopMutantDummyToken != null)
         {
             base.transform.localScale = coopMutantDummyToken.Scale;
             CoopMutantMaterialSync component = base.GetComponent <CoopMutantMaterialSync>();
             if (component && coopMutantDummyToken.MaterialIndex >= 0)
             {
                 component.ApplyMaterial(coopMutantDummyToken.MaterialIndex);
                 component.Disabled = true;
                 if (!this.Creepy)
                 {
                     if (coopMutantDummyToken.OriginalMutant)
                     {
                         Animator          componentInChildren      = coopMutantDummyToken.OriginalMutant.GetComponentInChildren <Animator>();
                         AnimatorStateInfo currentAnimatorStateInfo = componentInChildren.GetCurrentAnimatorStateInfo(0);
                         if (this.Replicator)
                         {
                             this.Replicator.ApplyHashToRemote(0, currentAnimatorStateInfo.fullPathHash, false, currentAnimatorStateInfo.normalizedTime, true);
                         }
                     }
                     dummyAnimatorControl component2 = base.GetComponent <dummyAnimatorControl>();
                     if (component2)
                     {
                         component2.hips.position = coopMutantDummyToken.HipPosition;
                         component2.hips.rotation = coopMutantDummyToken.HipRotation;
                     }
                     float      num        = float.PositiveInfinity;
                     GameObject gameObject = null;
                     for (int i = 0; i < Scene.SceneTracker.storedRagDollPrefabs.Count; i++)
                     {
                         if (Scene.SceneTracker.storedRagDollPrefabs[i] != null)
                         {
                             float num2 = Vector3.Distance(base.transform.position, Scene.SceneTracker.storedRagDollPrefabs[i].transform.position);
                             if (num2 < num)
                             {
                                 num        = num2;
                                 gameObject = Scene.SceneTracker.storedRagDollPrefabs[i];
                             }
                         }
                     }
                     if (gameObject)
                     {
                         storeLocalMutantInfo2 component3 = gameObject.transform.GetComponent <storeLocalMutantInfo2>();
                         this.jointRotations.Clear();
                         for (int j = 0; j < component3.jointAngles.Count; j++)
                         {
                             this.ragDollJoints[j].localRotation = component3.jointAngles[j];
                             this.jointRotations.Add(component3.jointAngles[j]);
                         }
                         if (component)
                         {
                             component.setSkinColor(component3.matColor);
                         }
                         if (component3.fireIndex.Count > 0)
                         {
                             base.StartCoroutine(this.transferClientFire(component3));
                         }
                         if (!this.ast)
                         {
                             this.ast = base.transform.GetComponent <arrowStickToTarget>();
                         }
                         if (!this.ast)
                         {
                             arrowStickToTarget[] componentsInChildren = base.transform.GetComponentsInChildren <arrowStickToTarget>(true);
                             if (componentsInChildren[0])
                             {
                                 this.ast = componentsInChildren[0];
                             }
                         }
                         if (this.ast)
                         {
                             int num3 = 0;
                             foreach (KeyValuePair <Transform, int> keyValuePair in component3.stuckArrowsIndex)
                             {
                                 if (keyValuePair.Key)
                                 {
                                     keyValuePair.Key.parent        = this.ast.stickToJoints[keyValuePair.Value];
                                     keyValuePair.Key.localPosition = component3.stuckArrowPos[num3];
                                     keyValuePair.Key.localRotation = component3.stuckArrowRot[num3];
                                     fakeArrowSetup component4 = keyValuePair.Key.GetComponent <fakeArrowSetup>();
                                     if (component4 && BoltNetwork.isRunning)
                                     {
                                         component4.storedIndex  = this.ast.stuckArrows.Count;
                                         component4.entityTarget = base.transform.root.GetComponent <BoltEntity>();
                                     }
                                     int count = this.ast.stuckArrows.Count;
                                     this.ast.stuckArrows.Add(keyValuePair.Key, count);
                                     num3++;
                                 }
                             }
                         }
                         this.doSync = true;
                     }
                 }
             }
             if (this.Creepy)
             {
                 base.StartCoroutine(this.syncRagDollPositions());
             }
             if (!this.Creepy)
             {
                 CoopMutantPropSync component5 = base.GetComponent <CoopMutantPropSync>();
                 if (component5)
                 {
                     component5.ApplyPropMask(coopMutantDummyToken.Props);
                 }
                 if (this.RegularParts && this.SkinnyParts)
                 {
                     if (coopMutantDummyToken.Skinny)
                     {
                         this.RegularParts.SetActive(false);
                         this.SkinnyParts.SetActive(true);
                     }
                     else
                     {
                         this.RegularParts.SetActive(true);
                         this.SkinnyParts.SetActive(false);
                     }
                 }
             }
         }
     }
 }