public void Pause() { if (!this.Enabled) { return; } Waiters.Interpolate(0.25, (Action <float>)(step => { ActiveTrackedSong temp_10 = this; int temp_15 = (temp_10.cancelPause ? 1 : 0) | (this.resumeRequested ? 1 : (!this.Enabled ? 1 : 0)); temp_10.cancelPause = temp_15 != 0; if (this.cancelPause) { return; } this.SoundManager.MusicVolumeFactor = FezMath.Saturate(1f - Easing.EaseOut((double)step, EasingType.Sine)); }), (Action)(() => { if (!this.cancelPause && !this.resumeRequested) { this.Watch.Stop(); foreach (ActiveLoop item_0 in this.ActiveLoops) { item_0.Pause(); } this.Enabled = false; this.SoundManager.MusicVolumeFactor = 1f; } this.cancelPause = this.resumeRequested = false; })); }
public void Update(GameTime gameTime) { for (int index = 0; index < this.Spline.Points.Length; ++index) { float amount = Easing.EaseOut((double)index / (double)(this.Spline.Points.Length - 1), EasingType.Sine); this.Spline.Points[index] = Vector3.Lerp(this.Instance.Center, this.DestinationMesh.Position, amount); Vector3 vector3 = Vector3.Zero + this.sideDirection * 3.5f * (0.7f - (float)Math.Sin((double)amount * 6.28318548202515 + 0.785398185253143)) + Vector3.Up * 2f * (0.7f - (float)Math.Cos((double)amount * 6.28318548202515 + 0.785398185253143)); if (index != 0 && index != this.Spline.Points.Length - 1) { this.Spline.Points[index] += vector3; } } this.Spline.Update(gameTime); if ((double)this.Spline.TotalStep - (double)this.lastStep > 0.025) { this.lastPoint = this.Spline.Current; this.lastStep = this.Spline.TotalStep; this.AddSegment(); } this.AlignLastSegment(); this.ColorSegments(); this.rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, (float)gameTime.ElapsedGameTime.TotalSeconds) * this.rotation; this.Cube.Position = this.Spline.Current + Vector3.Transform(this.positionOffset, this.rotation) * this.Spline.TotalStep; this.Cube.Rotation = Quaternion.Slerp(Quaternion.Identity, this.rotation, this.Spline.TotalStep); }
public void HideSpheres() { if (IsEmitting || SphereChosen) { return; } hiding = true; var fromInner = 450; var fromOuter = 852.2012f; Collider.collider.enabled = true; Wait.Until(t => { var step = Easing.EaseOut(Mathf.Clamp01(t * 6), EasingType.Cubic); Inner.transform.localScale = Vector3.Lerp(Vector3.one * fromInner, Vector3.zero, step); Outer.transform.localScale = Vector3.Lerp(Vector3.one * fromOuter, Vector3.zero, step); return(step >= 1 || SphereChosen || IsEmitting || showing); }, () => { if (!IsEmitting && !SphereChosen && !showing) { Outer.renderer.enabled = false; Inner.renderer.enabled = false; } hiding = false; }); }
protected virtual void CalculateSpeed() { float currentDistance = Vector3.Distance(this.transform.position, this.points[this.currentIndex]); float totalDistance = Vector3.Distance(this.points[this.currentIndex], this.points[this.nextIndex]); if (currentDistance / totalDistance < this.speedUpPercentage) { float lerpPercentage = currentDistance / (totalDistance * this.speedUpPercentage); if (this.useEasing) { lerpPercentage = Easing.EaseOut(lerpPercentage, EasingType.Quadratic); } this.currentSpeed = Mathf.Lerp(this.minSpeed, this.maxSpeed, lerpPercentage); this.currentSpeed = Mathf.Max(this.currentSpeed, this.impulseSpeed); } else if (currentDistance / totalDistance > this.slowDownPercentage) { float slowDownDistance = totalDistance * this.slowDownPercentage; float lerpPercentage = (currentDistance - slowDownDistance) / (totalDistance - slowDownDistance); if (this.useEasing) { lerpPercentage = Easing.EaseIn(lerpPercentage, EasingType.Cubic); } this.currentSpeed = Mathf.Lerp(this.maxSpeed, this.minSpeed, lerpPercentage); } else { this.currentSpeed = this.maxSpeed; } }
protected override void Update() { // If there's a pause defined, wait before doing the actual lerp... if (!m_bIsUpdating) { if (Time.time - m_fEventTime > m_fSecondsDelayBeforeStarting) { m_bIsUpdating = true; Init(); } else { return; } } float fRatio = (Time.time - m_fEventTime) / m_fDurationInSeconds; switch (m_iEasingEnds) { case EEasingEnds._In: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseIn(fRatio, m_iEasingType)); break; case EEasingEnds._InOut: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseInOut(fRatio, m_iEasingType)); break; case EEasingEnds._Out: m_vColour.a = Mathf.Lerp(m_fStartAlpha, m_fEndAlpha, Easing.EaseOut(fRatio, m_iEasingType)); break; } m_gcRenderer.color = m_vColour; if (fRatio >= 1.0f) { Destroy(this); } }
public void ChooseSphere(float hue) { SphereChosen = true; ChosenHue = hue; if (hue == InnerHue) { var OriginalScale = Outer.transform.localScale; Wait.Until(t => { var step = Easing.EaseOut(Mathf.Clamp01(t * 6), EasingType.Cubic); Outer.transform.localScale = Vector3.Lerp(OriginalScale, Vector3.zero, step); return(step >= 1); }, () => { Outer.renderer.enabled = false; }); } else if (hue == OuterHue) { var OriginalScale = Inner.transform.localScale; Wait.Until(t => { var step = Easing.EaseOut(Mathf.Clamp01(t * 6), EasingType.Cubic); Inner.transform.localScale = Vector3.Lerp(OriginalScale, Vector3.zero, step); return(step >= 1); }, () => { Inner.renderer.enabled = false; }); } }
IEnumerator valueUpdater(int workIndex) { float duration = 0.5f; float time = 0.0f; bool isComplete = false; int startPrice = _prevPrice; while (workIndex == _workIndex && isComplete == false) { time += 0.05f; float step = time / duration; step = Easing.EaseOut(time / duration, EasingType.Cubic); if (time >= duration) { step = 1.0f; isComplete = true; } if (isComplete) { setPrice(_currentPrice); } else { setPrice(Mathf.RoundToInt(Mathf.Lerp(startPrice, _currentPrice, step))); } yield return(ws005); } }
public override void Update(GameTime gameTime) { if (!this.tbCaptured) { return; } this.sinceStarted += (float)(gameTime.ElapsedGameTime.TotalSeconds * 1.5); int num1 = 0; foreach (Group group in this.mesh.Groups) { TileTransition.TileData tileData = (TileTransition.TileData)group.CustomData; float num2 = Easing.EaseOut((double)FezMath.Saturate(this.sinceStarted), EasingType.Quadratic) * 1.570796f; group.Rotation = Quaternion.CreateFromAxisAngle(tileData.Vertical ? Vector3.Left : Vector3.Up, tileData.Inverted ? num2 : -num2); group.Material.Diffuse = new Vector3(0.125f) + 0.875f * (tileData.B ? new Vector3((float)Math.Sin((double)num2)) : new Vector3((float)(1.0 - Math.Sin((double)num2)))); if ((double)num2 >= 1.57079637050629) { ++num1; } } if (num1 != this.mesh.Groups.Count) { return; } ServiceHelper.RemoveComponent <TileTransition>(this); }
public override void Draw(GameTime gameTime) { float alpha = FezMath.Saturate(Easing.EaseOut(this.SinceAlive.TotalSeconds / 1.0, EasingType.Quintic)); GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.Glitch)); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None); this.SpawnMesh.Draw(); GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All); GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.Glitch); float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); float m11 = this.CameraManager.Radius / ((float)this.StarsTexture.Width / 16f) / viewScale; float m22 = (float)((double)this.CameraManager.Radius / (double)this.CameraManager.AspectRatio / ((double)this.StarsTexture.Height / 16.0)) / viewScale; Matrix textureMatrix = new Matrix(m11, 0.0f, 0.0f, 0.0f, 0.0f, m22, 0.0f, 0.0f, (float)(-(double)m11 / 2.0), (float)(-(double)m22 / 2.0), 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f); if (this.SinceAlive.TotalSeconds > 2.0) { this.TargetRenderer.DrawFullscreen(new Color(1f, 1f, 1f, 1f - this.SpawnMesh.Material.Opacity)); } else if (this.SinceAlive.TotalSeconds < 1.0) { this.TargetRenderer.DrawFullscreen(Color.White); this.GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap; this.TargetRenderer.DrawFullscreen((Texture)this.StarsTexture, textureMatrix, new Color(1f, 1f, 1f, alpha)); } else if (this.SinceAlive.TotalSeconds > 1.0) { this.TargetRenderer.DrawFullscreen(new Color(this.redVisible ? 1f : 0.0f, this.greenVisible ? 1f : 0.0f, this.blueVisible ? 1f : 0.0f, 1f)); } GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None)); }
void Update() { float fRatio; switch (m_iState) { // Case fall-through does work in C# case Types.EDoorwayCollisionState._IDLE_OPEN: case Types.EDoorwayCollisionState._IDLE_CLOSED: break; case Types.EDoorwayCollisionState._OPENING: fRatio = (TimerManager.fGameTime - m_fEventTime) / Types.s_fDUR_DoorCloseDuration; transform.position = Vector3.Lerp(m_vClosedPosition, m_vOpenPosition, Easing.EaseOut(fRatio, EEasingType.Quartic)); if (fRatio >= 1.0f) { m_iState = Types.EDoorwayCollisionState._IDLE_OPEN; GameInstance.Object.GetAudioManager().PlayAudioAtLocation(transform.position, EGameSFX._SFX_DOOR_SHUT); } break; case Types.EDoorwayCollisionState._CLOSING: fRatio = (TimerManager.fGameTime - m_fEventTime) / Types.s_fDUR_DoorCloseDuration; transform.position = Vector3.Lerp(m_vOpenPosition, m_vClosedPosition, Easing.EaseOut(fRatio, EEasingType.Quartic)); if (fRatio >= 1.0f) { m_iState = Types.EDoorwayCollisionState._IDLE_CLOSED; GameInstance.Object.GetAudioManager().PlayAudioAtLocation(transform.position, EGameSFX._SFX_DOOR_SHUT); } break; } }
IEnumerator valueUpdater(int workIndex, float duration, Callback.Progress callback) { float time = 0.0f; bool isComplete = false; while (workIndex == _workIndex && isComplete == false) { time += 0.05f; float step = time / duration; step = Easing.EaseOut(time / duration, EasingType.Cubic); if (time >= duration) { step = 1.0f; isComplete = true; } if (callback != null) { callback(step, isComplete); } yield return(ws005); } }
void Update() { if (!active) { return; } sinceStarted += Time.deltaTime; forTransform.localScale = Vector3.Lerp(fromScale, scaleDestination, inverse ? Easing.EaseOut(Mathf.Clamp01(sinceStarted / TransitionOver), EasingType.Quartic) : Easing.EaseIn(Mathf.Clamp01(sinceStarted / TransitionOver), EasingType.Quartic)); if (sinceStarted >= TransitionOver) { active = false; if (OnComplete != null) { var oc = OnComplete; OnComplete = null; oc(); } } }
public override void Draw(GameTime gameTime) { if (this.RtHandle != null && this.TargetRenderer.IsHooked(this.RtHandle.Target)) { this.TargetRenderer.Resolve(this.RtHandle.Target, false); this.capturedScreen = (Texture)this.RtHandle.Target; if (this.ScreenCaptured != null) { this.ScreenCaptured(); } } GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Always, StencilMask.None); if (this.capturedScreen != null) { SettingsManager.SetupViewport(this.GraphicsDevice, false); this.TargetRenderer.DrawFullscreen(this.capturedScreen); } this.Elapsed += gameTime.ElapsedGameTime; float num = (float)this.Elapsed.TotalSeconds / this.Duration; float amount = FezMath.Saturate(this.EaseOut ? Easing.EaseOut((double)num, this.EasingType) : Easing.EaseIn((double)num, this.EasingType)); if ((double)amount == 1.0 && (this.WaitUntil == null || this.WaitUntil())) { if (this.Faded != null) { this.Faded(); this.Faded = (Action)null; } this.WaitUntil = (Func <bool>)null; ServiceHelper.RemoveComponent <ScreenFade>(this); } this.TargetRenderer.DrawFullscreen(Color.Lerp(this.FromColor, this.ToColor, amount)); }
public static float EaseMouse(float t) { if (t < 0) { return(-Easing.EaseOut(-t, EasingType.Quadratic)); } return(Easing.EaseOut(t, EasingType.Quadratic)); }
private void UpdateRays(float elapsedSeconds) { if (RandomHelper.Probability(0.03)) { float x = 6f + RandomHelper.Centered(4.0); float num = RandomHelper.Between(0.5, (double)x / 2.5); Group group = this.RaysMesh.AddGroup(); group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <FezVertexPositionTexture>(new FezVertexPositionTexture[6] { new FezVertexPositionTexture(new Vector3(0.0f, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, num / 2f, 0.0f), new Vector2(1f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.45f)), new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.55f)), new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0), 0.0f), new Vector2(1f, 1f)), new FezVertexPositionTexture(new Vector3(0.0f, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 1f)) }, new int[12] { 0, 1, 2, 0, 2, 5, 5, 2, 3, 5, 3, 4 }, PrimitiveType.TriangleList); group.CustomData = (object)new DotHost.RayState(); group.Material = new Material() { Diffuse = new Vector3(0.0f) }; group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Forward, RandomHelper.Between(0.0, 6.28318548202515)); } for (int i = this.RaysMesh.Groups.Count - 1; i >= 0; --i) { Group group = this.RaysMesh.Groups[i]; DotHost.RayState rayState = group.CustomData as DotHost.RayState; rayState.Age += elapsedSeconds * 0.15f; float num1 = Easing.EaseOut(Math.Sin((double)rayState.Age * 6.28318548202515 - 1.57079637050629) * 0.5 + 0.5, EasingType.Quadratic); group.Material.Diffuse = new Vector3(num1 * 0.0375f) + rayState.Tint.ToVector3() * 0.075f * num1; float num2 = rayState.Speed; group.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward, (float)((double)elapsedSeconds * (double)num2 * 0.300000011920929)); group.Scale = new Vector3((float)((double)num1 * 0.75 + 0.25), (float)((double)num1 * 0.5 + 0.5), 1f); if ((double)rayState.Age > 1.0) { this.RaysMesh.RemoveGroupAt(i); } } this.FlareMesh.Position = this.RaysMesh.Position = this.DotMesh.Position; this.FlareMesh.Rotation = this.RaysMesh.Rotation = Quaternion.Identity; this.RaysMesh.Scale = this.DotMesh.Scale * 0.5f; this.FlareMesh.Scale = new Vector3(MathHelper.Lerp(this.DotMesh.Scale.X * 0.875f, (float)Math.Pow((double)this.DotMesh.Scale.X * 1.5, 1.5), 1f)); this.FlareMesh.Material.Diffuse = new Vector3(0.25f * FezMath.Saturate(this.Opacity * 2f)); }
private void UpdateRays(float elapsedSeconds) { if (this.TrialRaysMesh.Groups.Count < 50 && RandomHelper.Probability(0.2)) { float x = 6f + RandomHelper.Centered(4.0); float num = RandomHelper.Between(0.5, (double)x / 2.5); Group group = this.TrialRaysMesh.AddGroup(); group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <FezVertexPositionTexture>(new FezVertexPositionTexture[6] { new FezVertexPositionTexture(new Vector3(0.0f, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, num / 2f, 0.0f), new Vector2(1f, 0.0f)), new FezVertexPositionTexture(new Vector3(x, (float)((double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.45f)), new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(1f, 0.55f)), new FezVertexPositionTexture(new Vector3(x, (float)(-(double)num / 2.0), 0.0f), new Vector2(1f, 1f)), new FezVertexPositionTexture(new Vector3(0.0f, (float)(-(double)num / 2.0 * 0.100000001490116), 0.0f), new Vector2(0.0f, 1f)) }, new int[12] { 0, 1, 2, 0, 2, 5, 5, 2, 3, 5, 3, 4 }, PrimitiveType.TriangleList); group.CustomData = (object)new DotHost.RayState(); group.Material = new Material() { Diffuse = new Vector3(0.0f) }; group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Forward, RandomHelper.Between(0.0, 6.28318548202515)); } for (int i = this.TrialRaysMesh.Groups.Count - 1; i >= 0; --i) { Group group = this.TrialRaysMesh.Groups[i]; DotHost.RayState rayState = group.CustomData as DotHost.RayState; rayState.Age += elapsedSeconds * 0.15f; float num1 = Easing.EaseOut((double)Easing.EaseOut(Math.Sin((double)rayState.Age * 6.28318548202515 - 1.57079637050629) * 0.5 + 0.5, EasingType.Quintic), EasingType.Quintic); group.Material.Diffuse = Vector3.Lerp(Vector3.One, rayState.Tint.ToVector3(), 0.05f) * 0.15f * num1; float num2 = rayState.Speed; group.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward, (float)((double)elapsedSeconds * (double)num2 * (0.100000001490116 + (double)Easing.EaseIn((double)this.TrialTimeAccumulator / 3.0, EasingType.Quadratic) * 0.200000002980232))); group.Scale = new Vector3((float)((double)num1 * 0.75 + 0.25), (float)((double)num1 * 0.5 + 0.5), 1f); if ((double)rayState.Age > 1.0) { this.TrialRaysMesh.RemoveGroupAt(i); } } this.TrialFlareMesh.Position = this.TrialRaysMesh.Position = this.Rings[0].Position; this.TrialFlareMesh.Rotation = this.TrialRaysMesh.Rotation = this.CameraManager.Rotation; this.TrialRaysMesh.Scale = new Vector3(Easing.EaseIn((double)this.TrialTimeAccumulator / 2.0, EasingType.Quadratic) + 1f); this.TrialFlareMesh.Material.Opacity = (float)(0.125 + (double)Easing.EaseIn((double)FezMath.Saturate((float)(((double)this.TrialTimeAccumulator - 2.0) / 3.0)), EasingType.Cubic) * 0.875); this.TrialFlareMesh.Scale = Vector3.One + this.TrialRaysMesh.Scale * Easing.EaseIn((double)Math.Max(this.TrialTimeAccumulator - 2.5f, 0.0f) / 1.5, EasingType.Cubic) * 4f; }
protected override void Delta() { float ease = Easing.EaseOut(Mathf.Clamp01(timer / duration), EasingType.Quadratic); Vector3 newVec = rectTransform.anchoredPosition; newVec.x = Mathf.Lerp(fromVec.x, toVec.x, ease); newVec.y = Mathf.Lerp(fromVec.y, toVec.y, ease); rectTransform.anchoredPosition = newVec; }
public override void Draw(GameTime gameTime) { if (this.GameState.Paused || this.GameState.InFpsMode || (this.GameState.Loading || this.GameState.InMap)) { return; } float alpha = Easing.EaseOut(FezMath.Saturate(this.Fader.TotalSeconds / 0.75), EasingType.Sine); Texture2D texture2D; if (this.NowViewing == Viewpoint.Left) { this.BitTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds; if ((double)this.BitTimer <= 0.0) { ++this.MessageIndex; if (this.MessageIndex > this.Message.Length + 2) { this.MessageIndex = -1; } this.BitTimer = this.MessageIndex < 0 || this.MessageIndex >= this.Message.Length || this.Message[this.MessageIndex] == 1 ? 0.75f : 0.5f; } texture2D = this.MessageIndex < 0 || this.MessageIndex >= this.Message.Length || (double)this.BitTimer < 0.25 ? this.LeftTextures[2] : this.LeftTextures[this.Message[this.MessageIndex]]; } else { texture2D = this.Textures[this.NowViewing]; } float num1 = (float)this.GraphicsDevice.Viewport.Width; float num2 = (float)this.GraphicsDevice.Viewport.Height; float num3 = (float)texture2D.Width; float num4 = (float)texture2D.Height; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); Matrix textureMatrix = new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, -0.5f, -0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f) * new Matrix((float)((double)num1 / (double)num3 / 2.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, (float)((double)num2 / (double)num4 / 2.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f) * new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.5f, 0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); GraphicsDevice graphicsDevice = this.GraphicsDevice; GraphicsDeviceExtensions.PrepareStencilWrite(graphicsDevice, new StencilMask?(StencilMask.CutsceneWipe)); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.None); this.TargetRenderer.DrawFullscreen((Texture)this.Mask, textureMatrix, new Color(1f, 1f, 1f, alpha)); GraphicsDeviceExtensions.PrepareStencilRead(graphicsDevice, CompareFunction.Always, StencilMask.CutsceneWipe); GraphicsDeviceExtensions.SetColorWriteChannels(graphicsDevice, ColorWriteChannels.All); this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, alpha)); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.NotEqual; float skyOpacity = this.GameState.SkyOpacity; this.GameState.SkyOpacity = alpha; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Additive); SkyHost.Instance.DrawBackground(); this.GameState.SkyOpacity = skyOpacity; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDeviceExtensions.SetBlendingMode(graphicsDevice, BlendingMode.Alphablending); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.Always; this.TargetRenderer.DrawFullscreen((Texture)this.Vignette, textureMatrix, new Color(1f, 1f, 1f, alpha * (1f - this.TimeManager.NightContribution))); GraphicsDeviceExtensions.GetDssCombiner(graphicsDevice).StencilFunction = CompareFunction.NotEqual; this.TargetRenderer.DrawFullscreen((Texture)texture2D, textureMatrix, new Color(1f, 1f, 1f, alpha * this.TimeManager.NightContribution)); }
public void UpdateState(OpenDirection open) { Angles rot = open switch { OpenDirection.Back => RotationBack, OpenDirection.Front => RotationFront, _ => RotationClosed }; if (Speed <= 0) { Speed = 0.1f; } var dfference = (Rotation.Angles() - rot).Normal; var distance = dfference.Length; var seconds = distance / Speed; _ = DoMove(Rotation.From(rot), seconds, open); } int movement = 0; async Task DoMove(Rotation target, float timeToTake, OpenDirection open) { var startPos = Rotation; int moveid = ++movement; for (float f = 0; f < 1;) { await Task.NextPhysicsFrame(); if (moveid != movement) { return; } var eased = Easing.EaseOut(f); var newPos = Rotation.Lerp(startPos, target, eased); SetPositionAndUpdateVelocity(newPos); f += Time.Delta / timeToTake; } if (open != OpenDirection.Closed && TimeBeforeReset >= 0) { await Task.DelaySeconds(TimeBeforeReset); if (moveid != movement) { return; } EnableAllCollisions = true; // Toggle(); } }
// Update is called once per frame void Update() { // rotate animation if (rotateAnimationTime > 0) { _rotationStep = Time.deltaTime / rotateAnimationTime * 360; gameObject.transform.RotateAround(gameObject.transform.position, Vector3.up, _rotationStep); } // glow animation if (glowAnimationTime > 0) { if (glowMinMax.x != glowMinMax.y) { if (_glowDelay > 0) { _glowDelay -= Time.deltaTime; } else { float glow = glowMinMax.x; float step = _glowAnimationStep / glowAnimationTime; if (_glowDirection > 0) { glow = (glowMinMax.y - glowMinMax.x) * Easing.EaseOut(step, EasingType.Quintic) + glowMinMax.x; } else { glow = (glowMinMax.y - glowMinMax.x) * (1 - step) + glowMinMax.x; } SetEmission(glow); // _glowAnimationStep += Time.deltaTime; // Set glow step if (_glowAnimationStep > glowAnimationTime) { _glowAnimationStep = 0; _glowDirection = -_glowDirection; if (_glowDirection < 0) { _glowDelay = glowAnimationDelay; } } } } else { SetEmission(glowMinMax.y); } } }
public void Update() { sinceAlive += Time.deltaTime; var step = Easing.EaseOut(sinceAlive / Lifetime, EasingType.Cubic); transform.localScale = new Vector3(baseScale.x, baseScale.y * (1 + step * maxScale), baseScale.z); GetComponentInChildren <Renderer>().material.SetColor("_TintColor", new Color(baseColor.r, baseColor.g, baseColor.b, Mathf.Clamp01(1 - step))); if (step >= 1) { Destroy(gameObject); } }
public override void Draw(GameTime gameTime) { this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; Vector2 vector2 = FezMath.Round(new Vector2((float)this.GraphicsDevice.Viewport.Width, (float)this.GraphicsDevice.Viewport.Height) / 2f); float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); this.LogoMesh.Material.Opacity = this.Opacity; this.LogoMesh.Draw(); this.spriteBatch.Begin(); float num = Easing.EaseOut((double)FezMath.Saturate((float)(((double)this.SinceStarted - 1.5) / 0.25)), EasingType.Quadratic); this.spriteBatch.Draw(this.PolytronText, vector2 + FezMath.Round(new Vector2((float)-this.PolytronText.Width / 2f, 120f * viewScale)), new Color(1f, 1f, 1f, this.Opacity * num)); this.spriteBatch.End(); }
public override void Update(GameTime gameTime) { if (this.GameState.TimePaused || this.GameState.Loading) { return; } this.CameraManager.Constrained = false; this.SinceStarted += (float)gameTime.ElapsedGameTime.TotalSeconds; if ((double)this.SinceStarted > 3.0 && !this.Walking) { this.Walking = true; this.Npc.State.LookingDirection = HorizontalDirection.Right; this.Npc.State.CurrentAction = NpcAction.Walk; this.Npc.State.UpdateAction(); this.Npc.State.SyncTextureMatrix(); } if (this.Npc.State.CurrentAction == NpcAction.Walk && (double)this.Npc.State.WalkStep == 1.0) { this.Npc.State.CurrentAction = NpcAction.Idle; this.Npc.State.UpdateAction(); this.Npc.State.SyncTextureMatrix(); } if ((double)this.Npc.State.WalkStep == 1.0) { this.SinceGotThere += (float)gameTime.ElapsedGameTime.TotalSeconds; if ((double)this.SinceGotThere < 0.5) { if (this.sLetterInsert != null) { SoundEffectExtensions.Emit(this.sLetterInsert); this.sLetterInsert = (SoundEffect)null; } this.Plane.Position = this.Npc.Group.Position + new Vector3((float)(FezMath.Sign(this.Npc.State.LookingDirection) * 4) / 16f, 0.375f, 0.0f) + new Vector3(-Easing.EaseIn((double)this.SinceGotThere / 0.5, EasingType.Quadratic), 0.375f, 0.0f); } if ((double)this.SinceGotThere > 12.5 && (double)this.SinceGotThere < 14.5) { this.Plane.Position = new Vector3(20.5f, 20.75f + Easing.EaseOut((double)FezMath.Saturate((float)((13.25 - (double)this.SinceGotThere) * 2.0)), EasingType.Cubic), 23.5f); } if (this.hooked) { return; } this.GomezService.ReadMail += new Action(this.Destroy); this.hooked = true; } else { this.Plane.Position = this.Npc.Group.Position + new Vector3((float)(FezMath.Sign(this.Npc.State.LookingDirection) * 4) / 16f, 0.375f, 0.0f); } }
public virtual void CreateLine() { this.lineRenderer.SetVertexCount(this.pointCount); Vector3 startPosition = Vector3.zero; Vector3 endPosition = new Vector3(this.distance, 0, 0); Vector3 direction = new Vector3(this.distance / (float)this.pointCount, 0, 0); for (int i = 0; i < this.pointCount; i++) { float percentage = (float)i / (float)this.pointCount; //Debug.Log ( "Current velocity: " + this.currentVelocity ); float currentDistance = this.distance * percentage; if (currentDistance < this.speedUpDistance) { float lerpPercentage = currentDistance / this.speedUpDistance; if (this.useEasing) { lerpPercentage = Easing.EaseOut(lerpPercentage, EasingType.Quadratic); } this.currentVelocity = Mathf.Lerp(0, this.maxVelocity, lerpPercentage); } else if (currentDistance > (this.distance - this.slowDownDistance)) { float lerpPercentage = (currentDistance - (this.distance - this.slowDownDistance)) / this.slowDownDistance; if (this.useEasing) { lerpPercentage = Easing.EaseIn(lerpPercentage, EasingType.Cubic); } this.currentVelocity = Mathf.Lerp(this.maxVelocity, 0, lerpPercentage); } else { this.currentVelocity = this.maxVelocity; } Vector3 currentPosition = startPosition + direction * i; Vector3 velocityOffset = new Vector3(0, this.currentVelocity, 0); this.lineRenderer.SetPosition(i, currentPosition + velocityOffset); } }
public override void Update(GameTime gameTime) { if (this.GameState.Loading || this.GameState.Paused || (this.GameState.InMap || this.GameState.InFpsMode)) { return; } this.InterpolatedRotation = Quaternion.Slerp(this.InterpolatedRotation, this.OriginalRotation * this.CameraManager.Rotation, 0.075f); if (this.InterpolatedRotation == this.CameraManager.Rotation) { if (this.eRumble.Dead || this.eRumble.Cue.State == SoundState.Paused) { return; } this.eRumble.Cue.Pause(); } else { Vector3 axis; float angle; OwlHeadHost.ToAxisAngle(ref this.InterpolatedRotation, out axis, out angle); float num = this.lastAngle - angle; if (this.eRumble.Cue.State == SoundState.Paused) { this.eRumble.Cue.Resume(); } this.eRumble.VolumeFactor = Math.Min(Easing.EaseOut((double)FezMath.Saturate(Math.Abs(num) * 10f), EasingType.Quadratic), 0.5f) * FezMath.Saturate(this.SinceStarted); this.SinceStarted += (float)gameTime.ElapsedGameTime.TotalSeconds; this.lastAngle = angle; if (FezMath.AlmostEqual(this.InterpolatedRotation, this.CameraManager.Rotation) || FezMath.AlmostEqual(-this.InterpolatedRotation, this.CameraManager.Rotation)) { this.InterpolatedRotation = this.CameraManager.Rotation; } Matrix matrix; if (this.IsInverted) { matrix = Matrix.CreateTranslation(0.25f, 0.0f, -0.75f) * Matrix.CreateFromQuaternion(this.InterpolatedRotation) * Matrix.CreateTranslation(this.OriginalTranslation.X - 0.75f, this.OriginalTranslation.Y, this.OriginalTranslation.Z - 0.25f); this.AttachedCandlesAo.Rotation = this.InterpolatedRotation; } else { matrix = Matrix.CreateTranslation((float)((this.IsBig ? 8.0 : 4.0) / 16.0), 0.0f, (float)-(this.IsBig ? 24 : 12) / 16f) * Matrix.CreateFromQuaternion(this.InterpolatedRotation) * Matrix.CreateTranslation((float)-(this.IsBig ? 8 : 4) / 16f + this.OriginalTranslation.X, this.OriginalTranslation.Y, (float)((this.IsBig ? 24.0 : 12.0) / 16.0) + this.OriginalTranslation.Z); } Vector3 scale; Quaternion rotation; Vector3 translation; matrix.Decompose(out scale, out rotation, out translation); this.OwlHeadAo.Position = translation; this.OwlHeadAo.Rotation = rotation; } }
public override void Update(GameTime gameTime) { if ((double)this.SinceStarted == 0.0 && (gameTime.ElapsedGameTime.Ticks != 0L && this.sPolytron != null)) { this.iPolytron = SoundEffectExtensions.Emit(this.sPolytron); this.sPolytron = (SoundEffect)null; } this.SinceStarted += (float)gameTime.ElapsedGameTime.TotalSeconds; float num = FezMath.Saturate(this.SinceStarted / 1.75f); this.UpdateStripe(3, Easing.EaseOut((double)Easing.EaseIn((double)num, EasingType.Quadratic), EasingType.Quartic) * 0.86f); this.UpdateStripe(2, Easing.EaseOut((double)Easing.EaseIn((double)num, EasingType.Cubic), EasingType.Quartic) * 0.86f); this.UpdateStripe(1, Easing.EaseOut((double)Easing.EaseIn((double)num, EasingType.Quartic), EasingType.Quartic) * 0.86f); this.UpdateStripe(0, Easing.EaseOut((double)Easing.EaseIn((double)num, EasingType.Quintic), EasingType.Quartic) * 0.86f); }
public override bool Update(Camera cam) { var delta = ((float)lifeTime).LerpInverse(0, Length, true); delta = Easing.EaseOut(delta); Vector3 rand = Vector3.Random; rand.z = 0; rand = rand.Normal; cam.Pos += (cam.Rot.Right * rand.x + cam.Rot.Up * rand.y) * (1 - delta) * Size; return(lifeTime < Length); }
public override void Draw(GameTime gameTime) { GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; Vector2 center = (new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height) / 2f).Round(); float viewScale = GraphicsDevice.GetViewScale(); float ease = Easing.EaseOut(FezMath.Saturate((SinceStarted - 1.5f) / 0.25f), EasingType.Quadratic); LogoMesh.Material.Opacity = Opacity; LogoMesh.Draw(); spriteBatch.Begin(); spriteBatch.Draw(PolytronText, center + new Vector2((-PolytronText.Width) / 2f, (128f + 120f / StripColors.Length) * viewScale).Round(), new Color(1f, 1f, 1f, Opacity * ease)); spriteBatch.End(); }
public override void Draw(GameTime gameTime) { float alpha1 = Easing.EaseOut(FezMath.Saturate(this.fader.TotalSeconds / 0.25), EasingType.Sine); float num1 = (float)this.GraphicsDevice.Viewport.Width; float num2 = (float)this.GraphicsDevice.Viewport.Height; float num3 = (float)this.letterTexture.Width; float num4 = (float)this.letterTexture.Height; this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice); Matrix textureMatrix = new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, -0.5f, -0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f) * new Matrix((float)((double)num1 / (double)num3 / 4.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, (float)((double)num2 / (double)num4 / 4.0) / viewScale, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f) * new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.85f, 0.5f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); this.TargetRenderer.DrawFullscreen(new Color(0.0f, 0.0f, 0.0f, 0.4f * alpha1)); this.TargetRenderer.DrawFullscreen((Texture)this.letterTexture, textureMatrix, new Color(1f, 1f, 1f, alpha1)); GraphicsDeviceExtensions.BeginPoint(this.sb); SpriteFont font = Culture.IsCJK ? this.FontManager.Small : this.FontManager.Big; float scale = (Culture.IsCJK ? this.FontManager.SmallFactor + 0.05f : this.FontManager.BigFactor) * viewScale; string text1 = this.LetterText; int num5 = Culture.IsCJK ? 500 : 135; string str = WordWrap.Split(text1, font, (float)num5); int lineSpacing = font.LineSpacing; if (!Culture.IsCJK) { font.LineSpacing = 14; } string text2 = str.Substring(0, Math.Min(str.Length, (int)(this.sinceStarted.TotalSeconds * 15.0))); if (this.oldLetterCount != this.CountChars(text2)) { SoundEffectExtensions.Emit(this.sLetterAppear); } this.oldLetterCount = this.CountChars(text2); float x = 335f * viewScale; float num6 = 176f * viewScale; Vector3 vector3 = LetterViewer.TextColor.ToVector3(); this.textRenderer.DrawString(this.sb, font, text2, new Vector2(x, num6 + scale * this.FontManager.TopSpacing), new Color(vector3.X, vector3.Y, vector3.Z, alpha1), scale); if (!Culture.IsCJK) { font.LineSpacing = lineSpacing; } float alpha2 = alpha1 * (float)FezMath.Saturate(this.sinceStarted.TotalSeconds - 2.0); this.textRenderer.DrawShadowedText(this.sb, this.FontManager.Big, StaticText.GetString("AchievementInTrialResume"), new Vector2(310f * viewScale, (float)(115.0 * (double)viewScale + (double)this.FontManager.TopSpacing * (double)scale)), new Color(0.5f, 1f, 0.5f, alpha2), this.FontManager.BigFactor * viewScale); this.sb.End(); }
private static float Ease(float t, EasingType ease = EasingType.Linear, bool easeIn = true, bool easeOut = true) { t = Mathf.Clamp01(t); if (easeIn && easeOut) { t = Easing.EaseInOut(t, ease); } else if (easeIn) { t = Easing.EaseIn(t, ease); } else if (easeOut) { t = Easing.EaseOut(t, ease); } return(t); }