Пример #1
0
 public void ToggleLight(RagdollHand interactor = null)
 {
     if (lightSound)
     {
         lightSound.Play();
     }
     if (light1)
     {
         light1.enabled = !light1.enabled;
         if (light1.enabled)
         {
             light1Sprite.Play();
         }
         else
         {
             light1Sprite.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
         }
     }
     if (light2)
     {
         light2.enabled = !light2.enabled;
         if (light2.enabled)
         {
             light2Sprite.Play();
         }
         else
         {
             light2Sprite.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
         }
     }
     if (interactor)
     {
         Utils.PlayHaptic(interactor.side == Side.Left, interactor.side == Side.Right, Utils.HapticIntensity.Minor);
     }
 }
Пример #2
0
 public void OnUngrabEvent(Handle handle, RagdollHand interactor, bool thrown)
 {
     if (interactor.playerHand != Player.local.handRight && interactor.playerHand != Player.local.handLeft && Random.value < module.aiTauntChance)
     {
         PlayTaunt(module.tauntDropAsset);
     }
 }
Пример #3
0
        IEnumerator SpawnArrowInBow(RagdollHand ragdollHand, Handle handle)
        {
            yield return(new WaitForEndOfFrame());

            Item      bow       = handle.item;
            BowString bowString = bow.GetCustomReference("StringHandle").gameObject.GetComponent <BowString>();

            //Debug.Log("String grabbed");

            if (bowString.nockedArrow == null && bowString.restedArrow == null && tryarrow)
            {
                tryarrow = false;
                //Debug.Log("No nocked arrow!");
                ragdollHand.UnGrab(false);

                if (!SpellAbilityManager.HasEnoughHealth(2))
                {
                    yield break;
                }

                //Debug.Log("Yup enough health!");
                Catalog.GetData <ItemData>("BloodArrow").SpawnAsync(delegate(Item arrow)
                {
                    Handle l_ArrowHandle = arrow.handles.First(h => h.interactableId == "ObjectHandleArrowBack");

                    ragdollHand.Grab(l_ArrowHandle, true);

                    bowString.NockArrow(l_ArrowHandle);

                    SpellAbilityManager.SpendHealth(2);

                    tryarrow = true;
                }, null, null, null, false, null);
            }
        }
Пример #4
0
 public void ExecuteAction(string action, RagdollHand interactor = null)
 {
     if (action == "cycleMode")
     {
         CycleMode(interactor);
     }
 }
Пример #5
0
 public void OnAnyHandleGrabbed(Handle handle, RagdollHand interactor)
 {
     if (handle.Equals(mainHandle))
     {
         // Handle Grabbed
         if (interactor.playerHand == Player.local.handRight)
         {
             mainHandleHeldRight = true;
         }
         if (interactor.playerHand == Player.local.handLeft)
         {
             mainHandleHeldLeft = true;
         }
         if ((mainHandleHeldRight || mainHandleHeldLeft) && (slideController != null))
         {
             slideController.UnlockSlide();
         }
     }
     if (handle.Equals(slideHandle))
     {
         // Slide Grabbed
         if (interactor.playerHand == Player.local.handRight)
         {
             slideHandleHeldRight = true;
         }
         if (interactor.playerHand == Player.local.handLeft)
         {
             slideHandleHeldLeft = true;
         }
         slideController.SetHeld(true);
         slideController.ForwardState();
     }
 }
Пример #6
0
 public void OnUngrabEvent(Handle handle, RagdollHand interactor, bool throwing)
 {
     if (isArmed)
     {
         detonateTime = module.detonateTime;
     }
 }
        public void OnMainGripGrabbed(RagdollHand interactor, Handle handle, EventTime eventTime)
        {
            if (interactor.playerHand == Player.local.handRight)
            {
                gunGripHeldRight = true;
            }
            if (interactor.playerHand == Player.local.handLeft)
            {
                gunGripHeldLeft = true;
            }

            if (!gunGripHeldLeft && !gunGripHeldRight)
            {
                if (isEmpty)
                {
                    ReloadWeapon();
                }
                thisNPC      = interactor.ragdoll.creature;
                thisNPCBrain = thisNPC.brain.instance;
                BrainBow     = thisNPCBrain.GetModule <BrainModuleBow>();
                BrainMelee   = thisNPCBrain.GetModule <BrainModuleMelee>();
                BrainParry   = thisNPCBrain.GetModule <BrainModuleParry>();
                thisNPC.brain.currentTarget = Player.local.creature;
                thisNPC.brain.isParrying    = true;

                BrainMelee.meleeEnabled = module.npcMeleeEnableOverride;
            }
        }
Пример #8
0
 public void Arm(RagdollHand interactor = null)
 {
     if (isOpen)
     {
         isArmed = !isArmed;
         if (interactor)
         {
             PlayerControl.GetHand(interactor.playerHand.side).HapticShort(1f);
         }
         if (isArmed)
         {
             armedSound.Play();
             idleSound.Stop();
             beepTime         = 1f;
             obstacle.enabled = true;
         }
         else
         {
             armedSound.Stop();
             idleSound.Play();
             beepTime = 0;
             SetLights(new bool[] { false, false, false });
             obstacle.enabled = false;
         }
     }
 }
Пример #9
0
 public void OnGrabEvent(Handle handle, RagdollHand interactor)
 {
     if (isArmed)
     {
         detonateTime = 0;
     }
 }
Пример #10
0
 private static void Postfix(HandleRagdoll __instance, RagdollHand ragdollHand, bool throwing)
 {
     if (__instance.ragdollPart.ragdoll.creature.FreezeData().IsCreatureFrozen&& !__instance.ragdollPart.ragdoll.isGrabbed && !__instance.ragdollPart.ragdoll.isTkGrabbed)
     {
         Instance.FreezeCreature(__instance.ragdollPart.ragdoll.creature);
     }
 }
Пример #11
0
 private static void Postfix(HandleRagdoll __instance, RagdollHand ragdollHand, float axisPosition, HandleOrientation orientation, bool teleportToHand = false)
 {
     if (__instance.ragdollPart.ragdoll.creature.FreezeData().IsCreatureFrozen)
     {
         Instance.UnFreezeCreature(__instance.ragdollPart.ragdoll.creature);
     }
 }
        public void OnAnyHandleUngrabbed(Handle handle, RagdollHand interactor, bool throwing)
        {
            if (handle.Equals(gunGrip))
            {
                if (interactor.playerHand == Player.local.handRight)
                {
                    gunGripHeldRight = false;
                }
                if (interactor.playerHand == Player.local.handLeft)
                {
                    gunGripHeldLeft = false;
                }

                if ((!gunGripHeldRight && !gunGripHeldLeft) && (slideController != null))
                {
                    slideHandle.data.positionDamperMultiplier = 1.0f;
                    slideHandle.data.positionSpringMultiplier = 1.0f;
                    slideHandle.data.rotationDamperMultiplier = 1.0f;
                    slideHandle.data.rotationSpringMultiplier = 1.0f;
                    slideController.LockSlide();
                }
            }
            if (handle.name.Equals(slideHandle.name))
            {
                if (interactor.playerHand == Player.local.handRight)
                {
                    slideGripHeldRight = false;
                }
                if (interactor.playerHand == Player.local.handLeft)
                {
                    slideGripHeldLeft = false;
                }
                slideController.SetHeld(false);
            }
        }
 public void OnAnyHandleGrabbed(Handle handle, RagdollHand interactor)
 {
     if (handle.Equals(gunGrip))
     {
         if (interactor.playerHand == Player.local.handRight)
         {
             gunGripHeldRight = true;
         }
         if (interactor.playerHand == Player.local.handLeft)
         {
             gunGripHeldLeft = true;
         }
         if ((gunGripHeldRight || gunGripHeldLeft) && (slideController != null))
         {
             slideHandle.data.positionDamperMultiplier = num1;
             slideHandle.data.positionSpringMultiplier = num2;
             slideHandle.data.rotationDamperMultiplier = num3;
             slideHandle.data.rotationSpringMultiplier = num4;
             slideController.UnlockSlide();
         }
     }
     if (handle.name.Equals(slideHandle.name))
     {
         if (interactor.playerHand == Player.local.handRight)
         {
             slideGripHeldRight = true;
         }
         if (interactor.playerHand == Player.local.handLeft)
         {
             slideGripHeldLeft = true;
         }
         slideController.SetHeld(true);
     }
 }
Пример #14
0
        public void OnHeldAction(RagdollHand interactor, Handle handle, Interactable.Action action)
        {
            if (action == Interactable.Action.AlternateUseStart)
            {
                ToggleWeapon();
            }
            if (action == Interactable.Action.Grab)
            {
                if (interactor.playerHand == Player.local.handRight)
                {
                    itemInRightHand = true;
                }
                if (interactor.playerHand == Player.local.handLeft)
                {
                    itemInLeftHand = true;
                }
            }

            if (action == Interactable.Action.Ungrab)
            {
                if (interactor.playerHand == Player.local.handRight)
                {
                    itemInRightHand = false;
                }
                if (interactor.playerHand == Player.local.handLeft)
                {
                    itemInLeftHand = false;
                }
            }
        }
Пример #15
0
 public void OnHeldAction(RagdollHand ragdollHand, Handle handle, Interactable.Action action)
 {
     if (action == Interactable.Action.UseStart)
     {
         if (ragdollHand.side == Side.Right)
         {
             rightHand = ragdollHand;
         }
         else
         {
             leftHand = ragdollHand;
         }
     }
     else if (action == Interactable.Action.UseStop || action == Interactable.Action.Ungrab)
     {
         if (ragdollHand.side == Side.Right)
         {
             rightHand = null;
         }
         else
         {
             leftHand = null;
         }
     }
 }
Пример #16
0
 public void OnHeldAction(RagdollHand interactor, Handle handle, Interactable.Action action)
 {
     if (action == Interactable.Action.UseStart)
     {
         if (interactor.side == Side.Right)
         {
             ExecuteAction(module.rightGripPrimaryAction, interactor);
         }
         else
         {
             ExecuteAction(module.leftGripPrimaryAction, interactor);
         }
     }
     else if (action == Interactable.Action.AlternateUseStart)
     {
         if (interactor.side == Side.Right)
         {
             ExecuteAction(module.rightGripSecondaryAction, interactor);
         }
         else
         {
             ExecuteAction(module.leftGripSecondaryAction, interactor);
         }
     }
 }
Пример #17
0
 public void OnUngrabEvent(Handle handle, RagdollHand interactor, bool throwing)
 {
     healer        = null;
     holdingRight &= interactor.playerHand == Player.local.handRight;
     holdingLeft  &= interactor.playerHand == Player.local.handLeft;
     light.enabled = false;
     text.enabled  = false;
 }
Пример #18
0
 public void OnGrabEvent(Handle handle, RagdollHand interactor)
 {
     healer        = interactor.creature;
     holdingRight |= interactor.playerHand == Player.local.handRight;
     holdingLeft  |= interactor.playerHand == Player.local.handLeft;
     light.enabled = true;
     text.enabled  = true;
 }
Пример #19
0
 public void OnHeldAction(RagdollHand interactor, Handle handle, Interactable.Action action)
 {
     if (handle.Equals(secondaryHandle) && action == Interactable.Action.UseStart && ((Time.time - prevShot) > module.fireDelay))
     {
         prevShot = Time.time;
         Fire();
     }
 }
Пример #20
0
 public static bool IsEmpty(this RagdollHand hand)
 {
     return(!hand.caster.isFiring &&
            !hand.caster.isMerging &&
            !Player.currentCreature.mana.mergeActive &&
            hand.grabbedHandle == null &&
            !hand.isGrabbed &&
            hand.caster.telekinesis.catchedHandle == null);
 }
Пример #21
0
 public void OnGrabEvent(Handle handle, RagdollHand interactor)
 {
     // toggle scope for performance reasons
     if (interactor.playerHand)
     {
         SetScopeRender(scopeL, scopeCameraL, scopeMaterialL, true);
         SetScopeRender(scopeR, scopeCameraR, scopeMaterialR, true);
     }
 }
Пример #22
0
 public void CycleMode(RagdollHand interactor = null)
 {
     currentMode       = (currentMode >= modes.Length - 1) ? 0 : currentMode + 1;
     renderer.material = materials[currentMode];
     if (interactor)
     {
         Utils.PlayHaptic(interactor.side == Side.Left, interactor.side == Side.Right, Utils.HapticIntensity.Minor);
     }
 }
Пример #23
0
        public static IEnumerator HapticPlayer(RagdollHand hand, AnimationCurve curve, float duration)
        {
            var time = Time.time;

            while (Time.time - time < duration)
            {
                hand.HapticTick(curve.Evaluate((Time.time - time) / duration));
                yield return(0);
            }
        }
Пример #24
0
        private void L_handle_UnGrabbed(RagdollHand ragdollHand, Handle handle, EventTime eventTime)
        {
            if (handle.handlers.Count <= 0)
            {
                swordSpawned      = false;
                handle.UnGrabbed -= L_handle_UnGrabbed;

                handle.gameObject.SetActive(false);
                handle.item.Despawn(0.2f);
            }
        }
Пример #25
0
 private void ItemRight_OnHeldActionEventRight(RagdollHand ragdollHand, Handle handle, Interactable.Action action)
 {
     if (action == Interactable.Action.AlternateUseStart)
     {
         Enhance(Side.Right);
     }
     if (action == Interactable.Action.AlternateUseStop)
     {
         Dehance(Side.Right);
     }
 }
Пример #26
0
 public void ExecuteAction(string action, RagdollHand interactor = null)
 {
     if (action == "arm")
     {
         Arm(interactor);
     }
     else if (action == "toggleSlider")
     {
         ToggleSlider(interactor);
     }
 }
Пример #27
0
 public void OnHeldAction(RagdollHand interactor, Handle handle, Interactable.Action action)
 {
     if (action == Interactable.Action.UseStart)
     {
         ExecuteAction(module.gripPrimaryAction, interactor);
     }
     else if (action == Interactable.Action.AlternateUseStart)
     {
         ExecuteAction(module.gripSecondaryAction, interactor);
     }
 }
Пример #28
0
 public void ExecuteAction(string action, RagdollHand ragdollHand = null)
 {
     if (action == "cycleScope")
     {
         CycleScope(ragdollHand);
     }
     else if (action == "cycleScopeBack")
     {
         CycleScopeBack(ragdollHand);
     }
 }
Пример #29
0
 public void CycleModels(RagdollHand interactor = null)
 {
     modelState++;
     if (modelState > 2)
     {
         modelState = 0;
     }
     primaryModel.ToList().ForEach(m => m.enabled   = (modelState == 0 || modelState == 1));
     secondaryModel.ToList().ForEach(m => m.enabled = (modelState == 0 || modelState == 2));
     if (interactor)
     {
         Utils.PlayHaptic(interactor.side == Side.Left, interactor.side == Side.Right, Utils.HapticIntensity.Minor);
     }
 }
        public void OnHeldAction(RagdollHand interactor, Handle handle, Interactable.Action action)
        {
            if (handle.Equals(gunGrip))
            {
                if (action == Interactable.Action.UseStart)
                {
                    if (module.waitForReloadAnim && IsAnimationPlaying(Animations, module.reloadAnim))
                    {
                        return;
                    }

                    triggerPressed = true;
                    if (module.isFlintlock)
                    {
                        StartCoroutine(FlintlockLinkedFire());
                    }
                    else if (!isFiring)
                    {
                        StartCoroutine(GeneralFire(TrackedFire, TriggerIsPressed, fireModeSelection, module.fireRate, module.burstNumber, emptySound, SetFiringFlag, ProjectileIsSpawning));
                    }
                }
                if (action == Interactable.Action.UseStop || action == Interactable.Action.Ungrab)
                {
                    // Stop Firing.
                    triggerPressed = false;
                }
                if (action == Interactable.Action.AlternateUseStart)
                {
                    if (module.waitForReloadAnim && IsAnimationPlaying(Animations, module.reloadAnim))
                    {
                        return;
                    }

                    if (module.allowCycleFireMode && !isEmpty)
                    {
                        if (emptySound != null)
                        {
                            emptySound.Play();
                        }
                        fireModeSelection = FrameworkCore.CycleFireMode(fireModeSelection, allowedFireModes);
                        //SetFireSelectionAnimator(Animations, fireModeSelection);
                    }
                    else if (isEmpty)
                    {
                        // Reload the weapon
                        ReloadWeapon();
                    }
                }
            }
        }