Beispiel #1
0
 public override void Detached()
 {
     if (BoltNetwork.isClient && Scene.MutantControler.activeNetCannibals.Contains(base.gameObject))
     {
         Scene.MutantControler.activeNetCannibals.Remove(base.gameObject);
     }
     if (this.creepy && BoltNetwork.isClient)
     {
         GameObject            gameObject = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, base.transform.position, base.transform.rotation);
         storeLocalMutantInfo2 component  = gameObject.GetComponent <storeLocalMutantInfo2>();
         Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject);
         component.identifier   = this.storedRagDollName;
         component.rootRotation = this.rootTr.rotation;
         component.rootPosition = this.rootTr.position;
         mutantTransferFire component2 = base.transform.GetComponent <mutantTransferFire>();
         if (component2)
         {
             for (int i = 0; i < component2.clientFireGo.Count; i++)
             {
                 spawnParticleController component3 = component2.clientFireGo[i].GetComponent <spawnParticleController>();
                 if (component3 && component3.spawnedPrefab)
                 {
                     int value = component2.allBones.IndexOf(component2.clientFireGo[i].transform.parent);
                     component.fireIndex.Add(component3.spawnedPrefab.transform, value);
                     component.firePos.Add(component2.clientFireGo[i].transform.localPosition);
                     component.fireRot.Add(component2.clientFireGo[i].transform.localRotation);
                     component3.spawnedPrefab.SendMessage("disableFollowTarget");
                 }
             }
         }
         CoopMutantMaterialSync component4 = base.transform.GetComponent <CoopMutantMaterialSync>();
         if (component4)
         {
             component.matColor = component4.storedColor;
         }
         for (int j = 0; j < this.storedCreepyJoints.Length; j++)
         {
             component.jointAngles.Add(this.storedCreepyJoints[j].localRotation);
         }
         if (this.ast)
         {
             int num = 0;
             foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows)
             {
                 if (keyValuePair.Key)
                 {
                     component.stuckArrowsIndex.Add(keyValuePair.Key, keyValuePair.Value);
                     component.stuckArrowPos.Add(keyValuePair.Key.localPosition);
                     component.stuckArrowRot.Add(keyValuePair.Key.localRotation);
                     if (num < this.ast.stuckArrowsTypeList.Count)
                     {
                         component.stuckArrowType.Add(this.ast.stuckArrowsTypeList[num]);
                     }
                     num++;
                 }
             }
         }
     }
 }
Beispiel #2
0
    public IEnumerator generateStoredJointList()
    {
        yield return(new WaitForEndOfFrame());

        if (this.doneGenerateList)
        {
            yield break;
        }
        GameObject            store = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, base.transform.position, base.transform.rotation);
        storeLocalMutantInfo2 slmi  = store.GetComponent <storeLocalMutantInfo2>();

        slmi.identifier = this.cms.storedRagDollName;
        slmi.jointAngles.Clear();
        for (int i = 0; i < this.jointsToSync.Length; i++)
        {
            slmi.jointAngles.Add(this.jointsToSync[i].localRotation);
        }
        CoopMutantMaterialSync cmms = base.transform.parent.GetComponent <CoopMutantMaterialSync>();

        if (cmms)
        {
            slmi.matColor = cmms.storedColor;
        }
        if (this.ast)
        {
            foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows)
            {
                if (keyValuePair.Key)
                {
                    slmi.stuckArrowsIndex.Add(keyValuePair.Key, keyValuePair.Value);
                    slmi.stuckArrowPos.Add(keyValuePair.Key.localPosition);
                    slmi.stuckArrowRot.Add(keyValuePair.Key.localRotation);
                }
            }
        }
        mutantTransferFire mtf = base.transform.parent.GetComponent <mutantTransferFire>();

        if (mtf)
        {
            for (int j = 0; j < mtf.clientFireGo.Count; j++)
            {
                spawnParticleController component = mtf.clientFireGo[j].GetComponent <spawnParticleController>();
                if (component && component.spawnedPrefab)
                {
                    int value = mtf.allBones.IndexOf(mtf.clientFireGo[j].transform.parent);
                    slmi.fireIndex.Add(component.spawnedPrefab.transform, value);
                    slmi.firePos.Add(mtf.clientFireGo[j].transform.localPosition);
                    slmi.fireRot.Add(mtf.clientFireGo[j].transform.localRotation);
                    component.spawnedPrefab.SendMessage("disableFollowTarget");
                }
            }
        }
        Scene.SceneTracker.storedRagDollPrefabs.Add(store);
        this.doneGenerateList = true;
        yield break;
    }
Beispiel #3
0
    private void CutDown()
    {
        bool           flag      = false;
        bool           flag2     = false;
        bool           flag3     = false;
        dummyTypeSetup component = base.transform.root.GetComponent <dummyTypeSetup>();

        if (component && (component._type == EnemyType.skinnyMale || component._type == EnemyType.skinnyFemale || component._type == EnemyType.skinnyMalePale))
        {
            flag = true;
        }
        if (this.femaleHair && this.femaleHair.activeSelf)
        {
            flag2 = true;
        }
        if (this.propManager)
        {
            this.isPoisoned = this.propManager.poisoned;
            if (this.propManager.skinnedHeadMask.activeSelf && this.isHead)
            {
                flag3 = true;
                this.propManager.skinnedHeadMask.SetActive(false);
            }
        }
        if (this.setupManager)
        {
            this.isPoisoned = this.setupManager.poisoned;
        }
        Vector3    position   = Vector3.zero;
        GameObject gameObject = null;

        if (this.instantiateCutPrefab)
        {
            Quaternion rotation;
            if (this.instantiatePivot)
            {
                position = this.instantiatePivot.transform.position;
                rotation = this.instantiatePivot.transform.rotation;
            }
            else
            {
                position = this.MyCut.transform.position;
                rotation = this.MyCut.transform.rotation;
            }
            if (!BoltNetwork.isClient)
            {
                if (flag)
                {
                    gameObject = UnityEngine.Object.Instantiate <GameObject>(this.spawnSkinny, position, rotation);
                }
                else
                {
                    gameObject = UnityEngine.Object.Instantiate <GameObject>(this.spawnRegular, position, rotation);
                }
                if (component && component._type == EnemyType.paleMale)
                {
                    gameObject.transform.localScale = gameObject.transform.localScale * 1.15f;
                }
                if (flag2)
                {
                    enableGoReceiver componentInChildren = gameObject.GetComponentInChildren <enableGoReceiver>();
                    if (componentInChildren)
                    {
                        componentInChildren.doEnableGo();
                    }
                }
                if (flag3)
                {
                    coopChoppedPartsReplicator component2 = gameObject.GetComponent <coopChoppedPartsReplicator>();
                    if (component2 && component2.faceMask)
                    {
                        component2.faceMask.SetActive(true);
                    }
                    else
                    {
                        flag3 = false;
                    }
                }
            }
            base.StartCoroutine(this.setupCutSkin(gameObject, flag));
        }
        else if (!BoltNetwork.isClient)
        {
            this.MyCut.SetActive(true);
            if (flag2)
            {
                enableGoReceiver componentInChildren2 = this.MyCut.GetComponentInChildren <enableGoReceiver>();
                if (componentInChildren2)
                {
                    componentInChildren2.doEnableGo();
                }
            }
            base.StartCoroutine(this.setupCutSkin(this.MyCut, flag));
        }
        if (BoltNetwork.isClient && this.storePrefab && this.instantiateCutPrefab)
        {
            GameObject            gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, position, base.transform.rotation);
            storeLocalMutantInfo2 component3  = gameObject2.GetComponent <storeLocalMutantInfo2>();
            Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject2);
            component3.mat = this.sourceMat;
            CoopMutantMaterialSync component4 = base.transform.root.GetComponent <CoopMutantMaterialSync>();
            if (component4)
            {
                component3.matColor = component4.storedColor;
            }
            else if (component)
            {
                if (this.isPoisoned)
                {
                    component3.matColor = Scene.SceneTracker.poisonedColor;
                }
                else if (component._type == EnemyType.paleMale || component._type == EnemyType.skinnyMalePale)
                {
                    component3.matColor = Scene.SceneTracker.paleMutantColor;
                }
                else
                {
                    component3.matColor = Scene.SceneTracker.regularMutantColor;
                }
            }
            component3.bloodPropertyBlock = this.bloodPropertyBlock;
            component3.showHair           = flag2;
            component3.showMask           = flag3;
        }
        SkinnedMeshRenderer component5 = this.MyPart.GetComponent <SkinnedMeshRenderer>();

        foreach (Transform transform in component5.bones)
        {
            IEnumerator enumerator = transform.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    object    obj        = enumerator.Current;
                    Transform transform2 = (Transform)obj;
                    if (transform2.GetComponent <arrowTrajectory>())
                    {
                        transform2.parent = null;
                        Rigidbody component6 = transform2.GetComponent <Rigidbody>();
                        if (component6)
                        {
                            component6.isKinematic = false;
                            component6.useGravity  = true;
                        }
                        Collider component7 = transform2.GetComponent <Collider>();
                        if (component7)
                        {
                            component7.isTrigger = false;
                            component7.enabled   = true;
                        }
                    }
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
        this.MyPart.SetActive(false);
        if (this.MyPartSkinny)
        {
            this.MyPartSkinny.SetActive(false);
        }
        if (this.props.Length > 0)
        {
            for (int j = 0; j < this.props.Length; j++)
            {
                this.props[j].SetActive(false);
            }
        }
        if (LocalPlayer.Transform && Vector3.Distance(LocalPlayer.Transform.position, base.transform.position) < 4f)
        {
            EventRegistry.Enemy.Publish(TfEvent.CutLimb, null);
        }
        this.MyCut.transform.parent = null;
        UnityEngine.Object.Destroy(base.gameObject);
    }
    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;
    }
Beispiel #5
0
    private IEnumerator syncRagDollPositions()
    {
        yield return(new WaitForFixedUpdate());

        float      closestDist        = float.PositiveInfinity;
        GameObject closestStoredToken = null;

        for (int i = 0; i < Scene.SceneTracker.storedRagDollPrefabs.Count; i++)
        {
            if (Scene.SceneTracker.storedRagDollPrefabs[i] != null)
            {
                float dist = Vector3.Distance(base.transform.position, Scene.SceneTracker.storedRagDollPrefabs[i].transform.position);
                if (dist < closestDist)
                {
                    closestDist        = dist;
                    closestStoredToken = Scene.SceneTracker.storedRagDollPrefabs[i];
                }
            }
        }
        if (closestStoredToken)
        {
            storeLocalMutantInfo2 component = closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>();
            if (!this.ast)
            {
                this.ast = base.transform.GetComponent <arrowStickToTarget>();
            }
            if (!this.ast)
            {
                arrowStickToTarget[] componentsInChildren = base.transform.GetComponentsInChildren <arrowStickToTarget>(true);
                if (componentsInChildren != null && componentsInChildren.Length > 0 && componentsInChildren[0])
                {
                    this.ast = componentsInChildren[0];
                }
            }
            if (this.ast)
            {
                int num = 0;
                foreach (KeyValuePair <Transform, int> keyValuePair in component.stuckArrowsIndex)
                {
                    if (keyValuePair.Key)
                    {
                        keyValuePair.Key.parent        = this.ast.stickToJoints[keyValuePair.Value];
                        keyValuePair.Key.localPosition = component.stuckArrowPos[num];
                        keyValuePair.Key.localRotation = component.stuckArrowRot[num];
                        fakeArrowSetup component2 = keyValuePair.Key.GetComponent <fakeArrowSetup>();
                        if (component2 && BoltNetwork.isRunning)
                        {
                            component2.storedIndex  = this.ast.stuckArrows.Count;
                            component2.entityTarget = base.transform.root.GetComponent <BoltEntity>();
                        }
                        int count = this.ast.stuckArrows.Count;
                        this.ast.stuckArrows.Add(keyValuePair.Key, count);
                        num++;
                    }
                }
            }
            if (component.fireIndex.Count > 0)
            {
                base.StartCoroutine(this.transferClientFire(component));
            }
            if (this.ragDollJoints.Length == 0)
            {
                yield break;
            }
            CoopMutantMaterialSync component3 = base.GetComponent <CoopMutantMaterialSync>();
            if (component3)
            {
                component3.setSkinColor(component.matColor);
            }
            if (this.rootTr)
            {
                this.rootTr.rotation = component.rootRotation;
                this.rootTr.position = component.rootPosition;
                if (component.jointAngles.Count > 0)
                {
                    for (int j = 0; j < this.ragDollJoints.Length; j++)
                    {
                        this.ragDollJoints[j].localRotation = component.jointAngles[j];
                    }
                }
            }
        }
        yield return(null);

        yield break;
    }
Beispiel #6
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);
                     }
                 }
             }
         }
     }
 }