Пример #1
0
        public void InitProjectile(int itemId, Transform rendererTr)
        {
            this.AttachRenderer(rendererTr);
            base.Invoke("enableDamageGo", 0.75f);
            enableGoReceiver enableGoReceiver = (!rendererTr) ? null : rendererTr.GetComponent <enableGoReceiver>();

            if (!enableGoReceiver)
            {
                this._pickup._itemId = itemId;
                Item item = ItemDatabase.ItemById(itemId);
                if (item != null)
                {
                    if (item._sheenMaterial)
                    {
                        this._pickup._sheen.GetComponent <Renderer>().sharedMaterial = item._sheenMaterial;
                    }
                    if (item._pickupMaterial)
                    {
                        this._pickup._myPickUp.GetComponent <Renderer>().sharedMaterial = item._pickupMaterial;
                    }
                }
            }
            else
            {
                UnityEngine.Object.Destroy(this._pickup.gameObject);
                UnityEngine.Object.Destroy(this._damage.gameObject);
                enableGoReceiver.doEnableGo();
            }
        }
Пример #2
0
    private IEnumerator syncPartsRoutine()
    {
        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 = (base.transform.position - Scene.SceneTracker.storedRagDollPrefabs[i].transform.position).sqrMagnitude;
                if (dist < closestDist)
                {
                    closestDist        = dist;
                    closestStoredToken = Scene.SceneTracker.storedRagDollPrefabs[i];
                }
            }
        }
        if (closestStoredToken && closestDist < 9f)
        {
            this.slmi = closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>();
            if (this.slmi)
            {
                if (this.slmi.showHair)
                {
                    enableGoReceiver componentInChildren = base.transform.GetComponentInChildren <enableGoReceiver>();
                    if (componentInChildren)
                    {
                        componentInChildren.doEnableGo();
                    }
                }
                if (this.slmi.showMask && this.faceMask)
                {
                    this.faceMask.SetActive(true);
                }
                this.setupCutSkin();
            }
        }
        yield return(null);

        if (closestStoredToken)
        {
            UnityEngine.Object.Destroy(closestStoredToken);
        }
        Scene.SceneTracker.storedRagDollPrefabs.RemoveAll((GameObject o) => o == null);
        Scene.SceneTracker.storedRagDollPrefabs.TrimExcess();
        yield break;
    }
Пример #3
0
        public void InitProjectile(int itemId, Transform rendererTr)
        {
            this.AttachRenderer(rendererTr);
            enableGoReceiver component = rendererTr.GetComponent <enableGoReceiver>();

            if (!component)
            {
                this._pickup._itemId = itemId;
            }
            else
            {
                UnityEngine.Object.Destroy(this._pickup.gameObject);
                UnityEngine.Object.Destroy(this._damage.gameObject);
                component.doEnableGo();
            }
        }
Пример #4
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);
    }