private void StartLaserCuttingFX() { if (fxControl != null && !fxIsPlaying) { int i = Player.main.IsUnderwater() ? 1 : 0; fxControl.Play(i); fxControl.Play(3); fxIsPlaying = true; fxLight.enabled = true; InvokeRepeating("RandomizeIntensity", 0f, 0.05f); totalTimeActive = 0f; } }
public void SetFlying(bool isFlying) { if (isFlying) { MainGameController instance = MainGameController.Instance; if (instance != null) { instance.RegisterHighFixedTimestepBehavior(this); } } else { MainGameController instance2 = MainGameController.Instance; if (instance2 != null) { instance2.DeregisterHighFixedTimestepBehavior(this); } } UWE.Utils.SetIsKinematicAndUpdateInterpolation(rb, !isFlying); collision.enabled = isFlying; fxControl.Play(0); }
public bool OnShoot() { if (TargetObject != null) { Utils.PlayFMODAsset(shootSound, transform, 20f); energyInterface.GetValues(out float charge, out float capacity); float d = Mathf.Min(1f, charge / 4f); energyInterface.ConsumeEnergy(4f); fxControl.Play(0); fxControl.Play(); if (TargetObject.TryGetComponent(out CreatureFrozenMixin creatureFrozenMixin)) { creatureFrozenMixin.FreezeInsideIce(); creatureFrozenMixin.FreezeForTime(20); } else if (TargetObject.TryGetComponent(out FreezeCannonFrozenMixin freezeCannonFrozenMixin)) { freezeCannonFrozenMixin.FreezeInsideIce(); freezeCannonFrozenMixin.FreezeForTime(20); } else { FreezeCannonFrozenMixin component = TargetObject.AddComponent <FreezeCannonFrozenMixin>(); component.FreezeInsideIce(); component.FreezeForTime(20); } ReleaseTargetObject(); fxControl.Stop(); return(true); } else { TargetObject = TraceForTarget(); return(false); } }
public void PlayFX() { if (fxControl != null) { print("PrefabTest: FX playing"); fxControl.Play(); return; } }
private bool TryUse(out float cooldownDuration) { if (Time.time - timeUsed >= cooldownTime) { SeamothArmManager control = ThisSeamoth.GetComponent <SeamothArmManager>(); Pickupable pickupable = null; PickPrefab x = null; GameObject activeTarget = control.GetActiveTarget(); if (activeTarget) { pickupable = activeTarget.GetComponent <Pickupable>(); x = activeTarget.GetComponent <PickPrefab>(); } if (pickupable != null && pickupable.isPickupable) { if (control.GetRoomForItem(pickupable) != null) { animator.SetTrigger("use_tool"); cooldownTime = (cooldownDuration = cooldownPickup); shownNoRoomNotification = false; return(true); } if (!shownNoRoomNotification) { ErrorMessage.AddMessage(Language.main.Get("ContainerCantFit")); shownNoRoomNotification = true; } } else { if (x != null) { animator.SetTrigger("use_tool"); cooldownTime = (cooldownDuration = cooldownPickup); return(true); } animator.SetTrigger("bash"); cooldownTime = (cooldownDuration = cooldownPunch); fxControl.Play(0); return(true); } } cooldownDuration = 0f; return(false); }
private PDAScanner.Result Scan() { if (stateCurrent != ScanState.None) { return(PDAScanner.Result.None); } if (idleTimer > 0f) { return(PDAScanner.Result.None); } PDAScanner.Result result = PDAScanner.Result.None; PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; if (scanTarget.isValid && energyMixin.charge > 0f) { result = PDAScanner.Scan(); if (result == PDAScanner.Result.Scan) { float amount = powerConsumption * Time.deltaTime; energyMixin.ConsumeEnergy(amount); stateCurrent = ScanState.Scan; } else if (result == PDAScanner.Result.Done || result == PDAScanner.Result.Researched) { idleTimer = 0.5f; PDASounds.queue.PlayIfFree(completeSound); if (fxControl != null) { fxControl.Play(0); } } } return(result); }
public void SetFlying(bool isFlying) { rb.isKinematic = !isFlying; collision.enabled = isFlying; fxControl.Play(0); }
public void OnHit() { #if DEBUG if (true) #else if (ThisSeamoth.CanPilot() && ThisSeamoth.GetPilotingMode()) #endif { Vector3 pos = Vector3.zero; GameObject hitObject = null; drillTarget = null; UWE.Utils.TraceFPSTargetPosition(ThisSeamoth.gameObject, attackDist, ref hitObject, ref pos, true); if (hitObject == null) { InteractionVolumeUser component = Player.main.gameObject.GetComponent <InteractionVolumeUser>(); if (component != null && component.GetMostRecent() != null) { hitObject = component.GetMostRecent().gameObject; } } if (hitObject && drilling) { var drillable = hitObject.FindAncestor <SeamothDrillable>(); loopHit.Play(); if (drillable) { drillable.OnDrill(fxSpawnPoint.position, ThisSeamoth, out GameObject gameObject2); if (!gameObject2) { StopEffects(); } drillTarget = gameObject2; if (fxControl.emitters[0].fxPS != null && !fxControl.emitters[0].fxPS.emission.enabled) { fxControl.Play(0); } } else { LiveMixin liveMixin = hitObject.FindAncestor <LiveMixin>(); if (liveMixin) { bool flag = liveMixin.IsAlive(); liveMixin.TakeDamage(4f, pos, DamageType.Drill, null); drillTarget = hitObject; } VFXSurface component2 = hitObject.GetComponent <VFXSurface>(); if (drillFXinstance == null) { drillFXinstance = VFXSurfaceTypeManager.main.Play(component2, vfxEventType, fxSpawnPoint.position, fxSpawnPoint.rotation, fxSpawnPoint); } else if (component2 != null && prevSurfaceType != component2.surfaceType) { VFXLateTimeParticles component3 = drillFXinstance.GetComponent <VFXLateTimeParticles>(); component3.Stop(); Destroy(drillFXinstance.gameObject, 1.6f); drillFXinstance = VFXSurfaceTypeManager.main.Play(component2, vfxEventType, fxSpawnPoint.position, fxSpawnPoint.rotation, fxSpawnPoint); prevSurfaceType = component2.surfaceType; } hitObject.SendMessage("BashHit", this, SendMessageOptions.DontRequireReceiver); } } else { StopEffects(); } } }
public void OnShoot() { energyInterface.GetValues(out float charge, out float capacity); if (charge > 0f) { float d = Mathf.Clamp01(charge / 4f); Vector3 forward = MainCamera.camera.transform.forward; Vector3 position = MainCamera.camera.transform.position; int hits = UWE.Utils.SpherecastIntoSharedBuffer(position, 1f, forward, 35f, ~(1 << LayerMask.NameToLayer("Player")), QueryTriggerInteraction.UseGlobal); float targetMass = 0f; for (int i = 0; i < hits; i++) { RaycastHit raycastHit = UWE.Utils.sharedHitBuffer[i]; Vector3 point = raycastHit.point; float magnitude = (position - point).magnitude; float d2 = 1f - Mathf.Clamp01((magnitude - 1f) / 35f); GameObject targetObject = UWE.Utils.GetEntityRoot(raycastHit.collider.gameObject); if (targetObject == null) { targetObject = raycastHit.collider.gameObject; } Rigidbody component = targetObject.GetComponent <Rigidbody>(); if (component != null) { targetMass += component.mass; bool flag = true; targetObject.GetComponents(iammo); for (int j = 0; j < iammo.Count; j++) { if (!iammo[j].GetAllowedToShoot()) { flag = false; break; } } iammo.Clear(); if (flag && !(raycastHit.collider is MeshCollider) && (targetObject.GetComponent <Pickupable>() != null || targetObject.GetComponent <Living>() != null || (component.mass <= 2600f && UWE.Utils.GetAABBVolume(targetObject) <= 800f))) { float d3 = 1f + component.mass * 0.005f; Vector3 velocity = forward * d2 * d * 140f / d3; ShootObject(component, velocity); } } } energyInterface.ConsumeEnergy(4f); fxControl.Play(); callBubblesFX = true; Utils.PlayFMODAsset(shootSound, transform, 20f); } }
private void FireSpray() { QuickLogger.Debug($"Firing {_mono?.PrefabId?.Id} Spray", true); _vaporFX.Play(0); _fireVapor = true; }