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); } }
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); } }
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); } }
public void ExecuteAction(string action, RagdollHand interactor = null) { if (action == "cycleMode") { CycleMode(interactor); } }
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(); } }
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; } }
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; } } }
public void OnGrabEvent(Handle handle, RagdollHand interactor) { if (isArmed) { detonateTime = 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); } }
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); } }
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; } } }
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; } } }
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); } } }
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; }
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; }
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(); } }
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); }
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); } }
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); } }
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); } }
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); } }
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); } }
public void ExecuteAction(string action, RagdollHand interactor = null) { if (action == "arm") { Arm(interactor); } else if (action == "toggleSlider") { ToggleSlider(interactor); } }
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); } }
public void ExecuteAction(string action, RagdollHand ragdollHand = null) { if (action == "cycleScope") { CycleScope(ragdollHand); } else if (action == "cycleScopeBack") { CycleScopeBack(ragdollHand); } }
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(); } } } }