private void Update() { if (input.value >= threshold && GrabManager.IsGrabbedAny(item)) { GrabManager.Release(item, blockTime); } }
public void DespawnPlayer() { if (NetGame.netlog) { Debug.LogFormat("Destroying {0}", netId); } if (isLocalPlayer) { if (skin != null) { App.StopPlaytimeForItem(skin.workshopId); } MenuCameraEffects.instance.RemoveHuman(this); Listener.instance.RemoveHuman(human); if (App.state == AppSate.Customize) { Player0Device = controls.device; } } host.RemovePlayer(this); if (isLocalPlayer) { PlayerManager.instance.OnLocalPlayerRemoved(this); } if (base.gameObject != null) { GrabManager.Release(base.gameObject); } Object.Destroy(base.gameObject); }
public void OnRelease() { if (!NetGame.isClient) { screen.Hide(); } GrabManager.Release(screen.gameObject, 0.3f); }
protected override void OnDestroy() { base.OnDestroy(); if (base.gameObject != null) { GrabManager.Release(base.gameObject); } }
public void OnTriggerEnter(Collider other) { if (doneMixing || other == null) { return; } bool flag = false; for (int i = 0; i < items.Length; i++) { if (!other.gameObject.transform.IsChildOf(items[i].item.transform)) { continue; } flag = true; if (items[i].mixEffect == MixEffect.Destroy || (itemAdded[i] == 0 && items[i].mixEffect == MixEffect.DestroyFirst)) { if (other.gameObject == items[i].item) { GrabManager.Release(other.gameObject); SendDestroyIngredient(i, -1); } else { for (int j = 0; j < items[i].item.transform.childCount; j++) { Transform child = items[i].item.transform.GetChild(j); if (other.gameObject.transform.IsChildOf(child)) { GrabManager.Release(other.gameObject); GrabManager.Release(child.gameObject); SendDestroyIngredient(i, j); break; } } } } itemAdded[i]++; items[i].itemAdded.Invoke(); if (itemAdded.All((int x) => x != 0)) { allItemsHaveBeenAdded = true; allItems.SetValue(1f); } break; } if (!flag) { badItemAdded.Invoke(); } }
protected virtual void Shatter(Vector3 contactPoint, Vector3 adjustedImpulse, float impactMagnitude, uint seed, uint netId) { renderer.enabled = false; collider.enabled = false; if (audio != null) { audio.Shatter(impactMagnitude, contactPoint); } if (audioSource != null) { audioSource.Shatter(impactMagnitude, contactPoint); } GrabManager.Release(base.gameObject); }
public void Respawn(Vector3 offset) { if (ReplayRecorder.isPlaying || NetGame.isClient) { return; } GrabManager.Release(base.gameObject); Vector3 vector = startPos + offset; Quaternion quaternion = startRot; if (overrides != null) { RespawningBodyOverride respawningBodyOverride = null; for (int i = 0; i < overrides.Count; i++) { if (overrides[i].checkpoint.number <= Game.instance.currentCheckpointNumber && (respawningBodyOverride == null || overrides[i].checkpoint.number > respawningBodyOverride.checkpoint.number)) { respawningBodyOverride = overrides[i]; } } if (respawningBodyOverride != null) { vector = respawningBodyOverride.initialToNewLocationMatrtix.MultiplyPoint3x4(vector); quaternion = respawningBodyOverride.initialToNewLocationRotation * quaternion; } } mJustReset = 5; mResetPosition = vector; mResetRotation = quaternion; base.transform.position = vector; base.transform.rotation = quaternion; if (syncLocalScale) { base.transform.localScale = startLocalScale; } UpdateVisibility(); if (m_respawnEvent != null) { m_respawnEvent.Invoke(); } else { Debug.LogError("Null respawn event.", this); } }
public void OnTriggerStay(Collider other) { Rigidbody componentInParent = other.GetComponentInParent <Rigidbody>(); if (componentInParent == null || componentInParent.isKinematic || bodiesAffected.Contains(componentInParent)) { return; } bodiesAffected.Add(componentInParent); worldWind = base.transform.TransformVector(wind) * input.value; normal = worldWind.normalized; D = Vector3.Dot(base.transform.position, normal); if (!(worldWind == Vector3.zero)) { float num = Vector3.Dot(componentInParent.worldCenterOfMass, normal) - D; Vector3 vector = componentInParent.worldCenterOfMass - num * normal - base.transform.position; float num2 = Mathf.InverseLerp(coreRadius + radialFalloff, coreRadius, vector.magnitude); float num3 = Mathf.InverseLerp(dist + distFalloff, dist, num); Human component = componentInParent.GetComponent <Human>(); float num4 = componentInParent.mass; if (component != null) { num4 = component.mass / (float)component.rigidbodies.Length; } float d = num4; Vector3 vector2 = (worldWind - componentInParent.velocity).magnitude * (worldWind - componentInParent.velocity) * cDrag * d; if (vector.magnitude > 0.1f) { vector2 += (0f - componentInParent.mass) * vector * centeringSpring; vector2 += componentInParent.mass * Vector3.Project(-componentInParent.velocity, vector) * centeringDamper; } vector2 *= num2 * num3; vector2 = Vector3.ClampMagnitude(vector2, num4 * maxAcceleration); if (vector2.magnitude / num4 > 10f && GrabManager.IsGrabbedAny(componentInParent.gameObject)) { GrabManager.Release(componentInParent.gameObject, 0.2f); } componentInParent.AddForce(vector2); Debug.DrawRay(componentInParent.worldCenterOfMass, vector2 / 10f / componentInParent.mass, Color.cyan, 0.1f); if (component != null) { componentInParent.AddForce(component.controls.walkDirection * humanFlyForce); } } }
private void FixedUpdate() { if (!topGrabbable && GrabManager.IsGrabbedAny(topTrack.gameObject)) { GrabManager.Release(topTrack.gameObject, 1f); } if (!bottomGrabbable && GrabManager.IsGrabbedAny(bottomTrack.gameObject)) { GrabManager.Release(bottomTrack.gameObject, 1f); } if (!startGrabbable && GrabManager.IsGrabbedAny(startTrack.gameObject)) { GrabManager.Release(startTrack.gameObject, 1f); } if (!endGrabbable && GrabManager.IsGrabbedAny(endTrack.gameObject)) { GrabManager.Release(endTrack.gameObject, 1f); } if (!ReplayRecorder.isPlaying && !NetGame.isClient && input.value != 0f && !(topTrack == null)) { AdvanceArrays(input.value * speed * Time.fixedDeltaTime); } }
private void Update() { if (pendingPlay > 0f) { float num = pendingPlay - Time.deltaTime; Show(); pendingPlay = num; } if (!videoLoaded) { return; } if (endTimer > 0f) { endTimer -= Time.deltaTime; if (endTimer <= 0f) { StopMovie(); } } if (movie != null && movieMaterialInstance == null) { if (movie.texture != null) { movieMaterialInstance = Object.Instantiate(HFFResources.instance.PCLinearMovieFixGame); } reinitMaterial = true; } if (reinitMaterial && movie != null && movieMaterialInstance != null) { reinitMaterial = false; if (movieMaterialInstance != null) { movieMaterialInstance.mainTexture = movie.texture; movieMaterialInstance.SetTexture("_EmissionMap", movie.texture); } renderer.sharedMaterial = movieMaterialInstance; } if (movie != null && subtitles != null && transitionPhase != 0f && transitionSpeed > 0f && inTransition) { time = audiosourceTime; if (currentLine != null && !currentLine.ShouldShow(time)) { if (lockedVOAndSubtitles) { SubtitleManager.instance.ClearSubtitle(); } currentLine = null; } if (currentLine == null) { currentLine = subtitles.GetLineToDisplay(time); if (currentLine != null && lockedVOAndSubtitles) { SubtitleManager.instance.SetSubtitle(ScriptLocalization.Get("SUBTITLES/" + currentLine.key)); } } } if (!inTransition) { return; } if (transitionPhase == 0f && transitionSpeed > 0f && movie != null) { renderer.sharedMaterial = movieMaterialInstance; audiosourceStart = Time.unscaledTime; lockedVOAndSubtitles = true; movie.Play(); } transitionPhase = Mathf.Clamp01(transitionPhase + Time.deltaTime * transitionSpeed); float num2 = Ease.easeInOutQuad(0f, 1f, transitionPhase); float num3 = width / 16f * 9f; Create2SidedMesh((0f - width) / 2f * num2, (0f - num3) / 2f, width / 2f * num2, num3 / 2f, 0.5f - num2 / 2f, 0f, 0.5f + num2 / 2f, 1f); mesh.vertices = meshVerts; mesh.uv = uvs; mesh.RecalculateNormals(); mesh.RecalculateBounds(); filter.sharedMesh = mesh; collider.size = ((num2 != 0f) ? new Vector3(width * num2, num3, 0.1f) : Vector3.zero); if (transitionPhase == 0f && transitionSpeed < 0f) { if (playingScreen == this) { playingScreen = null; } inTransition = false; StopMovie(); RemoveSubtitles(); renderer.sharedMaterial = blankMaterial; GrabManager.Release(base.gameObject); } }
private void ResetPlayer(Human human) { GrabManager.Release(human.gameObject); human.ReleaseGrab(); human.Reset(); }