コード例 #1
0
ファイル: ItemDarkChain.cs プロジェクト: Ebediam/DarkChains
        void CheckForDestroy(PlayerControl.Hand hand)
        {
            if (hand.alternateUsePressed && hand.usePressed)
            {
                isEnding = true;
                Telekinesis tele;
                if (hand.side == Side.Left)
                {
                    tele = Player.local.handLeft.bodyHand.telekinesis;
                }
                else
                {
                    tele = Player.local.handRight.bodyHand.telekinesis;
                }

                DarkChains.DarkChainDestroy(item, myRagdollPart, ragdollHandle, tele, neck);
            }
        }
コード例 #2
0
ファイル: ItemDarkChain.cs プロジェクト: Ebediam/DarkChains
        public void OnTeleUnGrabAction(Handle handle, Telekinesis teleGrabber)
        {
            if (!teleUngrabbing)
            {
                teleUngrabbing      = true;
                item.rb.isKinematic = true;
                if (!module.freezeEnemiesInTheAir)
                {
                    teleGrabber.TryRelease();
                    isEnding = true;
                    DarkChains.DarkChainDestroy(item, myRagdollPart, ragdollHandle, teleGrabber, neck);
                }

                if (neck && module.choking)
                {
                    chokeSFX.Stop();
                    choking = false;
                    NPC.OnChoke(false);
                    NPC.speak.enabled       = true;
                    NPC.speak.speakLoudness = 1f;
                }
            }
        }
コード例 #3
0
ファイル: ItemDarkChain.cs プロジェクト: Ebediam/DarkChains
        void FixedUpdate()
        {
            if (module.choking)
            {
                if (choking && !chokeSFX.isPlaying)
                {
                    NPC.health.Kill();
                }
                if (choking && NPC.state != Creature.State.Dead)
                {
                    if (Vector3.Distance(item.transform.position, rightHand.transf.position) > 0.1f)
                    {
                        rightHand.transf.position = Vector3.Lerp(rightHand.transf.position, item.transform.position, 0.1f);
                    }
                    if (Vector3.Distance(item.transform.position, leftHand.transf.position) > 0.1f)
                    {
                        leftHand.transf.position = Vector3.Lerp(leftHand.transf.position, item.transform.position, 0.1f);
                    }

                    if (Vector3.Distance(leftHand.transf.position, rightHand.transf.position) > 0.1f)
                    {
                        rightHand.transf.position = Vector3.Lerp(rightHand.transf.position, leftHand.transform.position, 0.02f);
                        leftHand.transf.position  = Vector3.Lerp(leftHand.transf.position, rightHand.transform.position, 0.02f);
                    }
                }

                if (NPC.state == Creature.State.Dead && chokeSFX.isPlaying)
                {
                    chokeSFX.Stop();
                }
            }


            if (!myRagdollPart.ragdoll.creature)
            {
                DarkChains.DarkChainDestroy(item, myRagdollPart, ragdollHandle, neck);
            }
            else
            {
                if (Vector3.Distance(myRagdollPart.transf.position, myRagdollPart.ragdoll.creature.body.hipsBone.transform.position) > 1.6f && !sliced && sliceable)
                {
                    myRagdollPart.ragdoll.creature.health.currentHealth -= 2000f;
                    if (myRagdollPart.ragdoll.creature.health.currentHealth <= 0f)
                    {
                        myRagdollPart.ragdoll.creature.health.Kill();
                    }

                    if (myRagdollPart.partData.bone.ToString() != "Head")
                    {
                        myRagdollPart.ragdoll.Slice(myRagdollPart.partData.bone);
                    }
                }


                if (item.isTeleGrabbed && module.freezeEnemiesInTheAir)
                {
                    CheckForDestroy(PlayerControl.handLeft);
                    CheckForDestroy(PlayerControl.handRight);
                }


                if (myRagdollPart.rb.isKinematic == false && !isEnding && !DarkChains.reseting)
                {
                    myRagdollPart.rb.isKinematic = true;
                }
                else
                {
                    myRagdollPart.rb.isKinematic = false;
                }


                if (ragdollHandle != null && myRagdollPart != null && item != null && item.gameObject != null && !isEnding && !DarkChains.reseting)
                {
                    if (myRagdollPart.transf.position != item.transform.position)
                    {
                        myRagdollPart.transf.position    = item.transform.position;
                        myRagdollPart.transform.rotation = item.transform.rotation;
                    }
                }
            }
        }