diff --git a/Assets/Audio/step1.wav b/Assets/Audio/step1.wav index a368527..e69574b 100644 Binary files a/Assets/Audio/step1.wav and b/Assets/Audio/step1.wav differ diff --git a/Assets/Audio/step2.wav b/Assets/Audio/step2.wav index e9aaf78..7496853 100644 Binary files a/Assets/Audio/step2.wav and b/Assets/Audio/step2.wav differ diff --git a/Assets/Audio/step3.wav b/Assets/Audio/step3.wav index 7b6ff19..a5010c2 100644 Binary files a/Assets/Audio/step3.wav and b/Assets/Audio/step3.wav differ diff --git a/Assets/Audio/step4.wav b/Assets/Audio/step4.wav index d7b604c..5b488ae 100644 Binary files a/Assets/Audio/step4.wav and b/Assets/Audio/step4.wav differ diff --git a/Assets/Audio/step5.wav b/Assets/Audio/step5.wav new file mode 100644 index 0000000..f6c563e Binary files /dev/null and b/Assets/Audio/step5.wav differ diff --git a/Assets/Audio/step6.wav b/Assets/Audio/step6.wav new file mode 100644 index 0000000..46943ac Binary files /dev/null and b/Assets/Audio/step6.wav differ diff --git a/Assets/Audio/step7.wav b/Assets/Audio/step7.wav new file mode 100644 index 0000000..fdbbf2f Binary files /dev/null and b/Assets/Audio/step7.wav differ diff --git a/Assets/Audio/step8.wav b/Assets/Audio/step8.wav new file mode 100644 index 0000000..8388aa2 Binary files /dev/null and b/Assets/Audio/step8.wav differ diff --git a/Assets/Audio/step9.wav b/Assets/Audio/step9.wav new file mode 100644 index 0000000..44cd101 Binary files /dev/null and b/Assets/Audio/step9.wav differ diff --git a/Assets/Audio/tele2.wav b/Assets/Audio/tele2.wav new file mode 100644 index 0000000..0568196 Binary files /dev/null and b/Assets/Audio/tele2.wav differ diff --git a/Assets/Audio/tele_water.wav b/Assets/Audio/tele_water.wav new file mode 100644 index 0000000..3db6a18 Binary files /dev/null and b/Assets/Audio/tele_water.wav differ diff --git a/Assets/Audio/tele_woosh.wav b/Assets/Audio/tele_woosh.wav new file mode 100644 index 0000000..ce14b8d Binary files /dev/null and b/Assets/Audio/tele_woosh.wav differ diff --git a/Content/Audio/jumpland1_22.flax b/Content/Audio/jumpland1_22.flax deleted file mode 100644 index 8ef4826..0000000 Binary files a/Content/Audio/jumpland1_22.flax and /dev/null differ diff --git a/Content/Audio/jumpland_var1.flax b/Content/Audio/jumpland_var1.flax index fe9100b..594796a 100644 Binary files a/Content/Audio/jumpland_var1.flax and b/Content/Audio/jumpland_var1.flax differ diff --git a/Content/Audio/jumpland_var2.flax b/Content/Audio/jumpland_var2.flax index fc426a3..ef64906 100644 Binary files a/Content/Audio/jumpland_var2.flax and b/Content/Audio/jumpland_var2.flax differ diff --git a/Content/Audio/jumpland_var3.flax b/Content/Audio/jumpland_var3.flax index 67a1ebd..412f189 100644 Binary files a/Content/Audio/jumpland_var3.flax and b/Content/Audio/jumpland_var3.flax differ diff --git a/Content/Audio/jumpland_var4.flax b/Content/Audio/jumpland_var4.flax index 829140e..8f84146 100644 Binary files a/Content/Audio/jumpland_var4.flax and b/Content/Audio/jumpland_var4.flax differ diff --git a/Content/Audio/jumpland_var5.flax b/Content/Audio/jumpland_var5.flax index 2ac1383..704e7b7 100644 Binary files a/Content/Audio/jumpland_var5.flax and b/Content/Audio/jumpland_var5.flax differ diff --git a/Content/Audio/jumpland_var6.flax b/Content/Audio/jumpland_var6.flax new file mode 100644 index 0000000..90d4f8d Binary files /dev/null and b/Content/Audio/jumpland_var6.flax differ diff --git a/Content/Audio/jumpland_var7.flax b/Content/Audio/jumpland_var7.flax new file mode 100644 index 0000000..b2252bf Binary files /dev/null and b/Content/Audio/jumpland_var7.flax differ diff --git a/Content/Audio/jumpland_var8.flax b/Content/Audio/jumpland_var8.flax new file mode 100644 index 0000000..298eb6f Binary files /dev/null and b/Content/Audio/jumpland_var8.flax differ diff --git a/Content/Audio/jumpland_var9.flax b/Content/Audio/jumpland_var9.flax new file mode 100644 index 0000000..fa9c52e Binary files /dev/null and b/Content/Audio/jumpland_var9.flax differ diff --git a/Content/Audio/player_jumpland.flax b/Content/Audio/player_jumpland.flax deleted file mode 100644 index e5d3828..0000000 Binary files a/Content/Audio/player_jumpland.flax and /dev/null differ diff --git a/Content/Audio/player_jumplandv2.flax b/Content/Audio/player_jumplandv2.flax deleted file mode 100644 index 904a68c..0000000 Binary files a/Content/Audio/player_jumplandv2.flax and /dev/null differ diff --git a/Content/Materials/WeaponMaterial.flax b/Content/Materials/WeaponMaterial.flax index cbc0617..c0e9b81 100644 Binary files a/Content/Materials/WeaponMaterial.flax and b/Content/Materials/WeaponMaterial.flax differ diff --git a/Content/Settings/EngineSettings/InputSettings.json b/Content/Settings/EngineSettings/InputSettings.json index 2ecde14..da90c7d 100644 --- a/Content/Settings/EngineSettings/InputSettings.json +++ b/Content/Settings/EngineSettings/InputSettings.json @@ -1,7 +1,7 @@ { "ID": "8ec53dba4c238bfbea1d62922e612a4d", "TypeName": "FlaxEditor.Content.Settings.InputSettings", - "EngineBuild": 6330, + "EngineBuild": 6331, "Data": { "ActionMappings": [ { @@ -127,26 +127,26 @@ "Snap": true }, { - "Name": "Horizontal", + "Name": "LookRight", "Axis": 9, "Gamepad": 0, "PositiveButton": 39, "NegativeButton": 37, - "DeadZone": 0.01, - "Sensitivity": 5.0, - "Gravity": 5.0, + "DeadZone": 0.0, + "Sensitivity": 1.0, + "Gravity": 800.0, "Scale": 1.0, "Snap": true }, { - "Name": "Vertical", + "Name": "LookUp", "Axis": 9, "Gamepad": 0, "PositiveButton": 38, "NegativeButton": 40, - "DeadZone": 0.001, - "Sensitivity": 5.0, - "Gravity": 5.0, + "DeadZone": 0.0, + "Sensitivity": 1.0, + "Gravity": 800.0, "Scale": 1.0, "Snap": true }, diff --git a/Content/TestMat.flax b/Content/TestMat.flax index e89c8af..fa8cf2b 100644 Binary files a/Content/TestMat.flax and b/Content/TestMat.flax differ diff --git a/Source/Game/AudioManager.cs b/Source/Game/AudioManager.cs index 784395a..11dfb71 100644 --- a/Source/Game/AudioManager.cs +++ b/Source/Game/AudioManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using FlaxEngine; using Console = Cabrito.Console; using Object = FlaxEngine.Object; @@ -126,6 +127,8 @@ namespace Game if (volume != 1f) audioSource.Name += ", vol: " + volume.ToString(); + if (pitch != 1f) + audioSource.Name += ", pitch: " + pitch.ToString(); audioSource.Play(); Object.Destroy(audioSource, audioClip.Length); @@ -136,6 +139,50 @@ namespace Game } } + public static async void PlaySoundDelayed(Vector2 delayRange, string soundName, Actor actor, int channel, Vector3 position, float volume = 1f) + { + float randomDelay; + if (delayRange[0] < delayRange[1]) + randomDelay = (float)(delayRange[0] + (random.NextDouble() * (delayRange[1] - delayRange[0]))); + else + randomDelay = delayRange[0]; + + //PlaySoundDelayed(delay, soundName, actor, channel, AudioFlags.None, position, volume, Vector2.One); + await Task.Delay((int)(randomDelay * 1000f)); + //FlaxEngine.Scripting.RunOnUpdate(() => + // PlaySound(soundName, actor, channel, flags, position, volume, pitchRange)); + PlaySound(soundName, actor, channel, AudioFlags.None, position, volume, Vector2.One); + } + + public static async void PlaySoundDelayed(Vector2 delayRange, string soundName, Actor actor, int channel, Vector3 position, float volume, Vector2 pitchRange) + { + float randomDelay; + if (delayRange[0] < delayRange[1]) + randomDelay = (float)(delayRange[0] + (random.NextDouble() * (delayRange[1] - delayRange[0]))); + else + randomDelay = delayRange[0]; + + //PlaySoundDelayed(delay, soundName, actor, channel, AudioFlags.None, position, volume, Vector2.One); + await Task.Delay((int)(randomDelay * 1000f)); + //FlaxEngine.Scripting.RunOnUpdate(() => + // PlaySound(soundName, actor, channel, flags, position, volume, pitchRange)); + PlaySound(soundName, actor, channel, AudioFlags.None, position, volume, pitchRange); + } + + public static async void PlaySoundDelayed(Vector2 delayRange, string soundName, Actor actor, int channel, AudioFlags flags, Vector3 position, float volume, Vector2 pitchRange) + { + float randomDelay; + if (delayRange[0] < delayRange[1]) + randomDelay = (float)(delayRange[0] + (random.NextDouble() * (delayRange[1] - delayRange[0]))); + else + randomDelay = delayRange[0]; + + await Task.Delay((int)(randomDelay * 1000f)); + //FlaxEngine.Scripting.RunOnUpdate(() => + // PlaySound(soundName, actor, channel, flags, position, volume, pitchRange)); + PlaySound(soundName, actor, channel, flags, position, volume, pitchRange); + } + public static void StopSound(Actor actor, int channel) { if (channel <= 0) diff --git a/Source/Game/Cabrito/EngineSubsystem.cs b/Source/Game/Cabrito/EngineSubsystem.cs index 320d6cc..13846c3 100644 --- a/Source/Game/Cabrito/EngineSubsystem.cs +++ b/Source/Game/Cabrito/EngineSubsystem.cs @@ -171,5 +171,24 @@ namespace Cabrito } } } + + [ConsoleVariable("cl_showweapon")] + public static string ShowWeapon + { + get + { + return Level.FindActor("ViewModelCamera").IsActive ? "1" : "0"; + } + set + { + bool boolValue = false; + if (int.TryParse(value, out int intValue)) + boolValue = intValue != 0; + else if (float.TryParse(value, out float valueFloat)) + boolValue = valueFloat != 0f; + + Level.FindActor("ViewModelCamera").IsActive = boolValue; + } + } } } \ No newline at end of file diff --git a/Source/Game/CameraMovement.cs b/Source/Game/CameraMovement.cs index df84295..2a3d203 100644 --- a/Source/Game/CameraMovement.cs +++ b/Source/Game/CameraMovement.cs @@ -52,22 +52,16 @@ namespace Game float yAxis = InputManager.GetAxisRaw("Mouse Y"); if (xAxis != 0.0f || yAxis != 0.0f) { - - - viewPitch += yAxis; viewYaw += xAxis; viewPitch = Mathf.Clamp(viewPitch, -90.0f, 90.0f); - // root orientation must be set first rootActor.Orientation = Quaternion.Euler(0, viewYaw, 0); camera.Orientation = Quaternion.Euler(viewPitch, viewYaw, viewRoll); } - - float inputH = InputManager.GetAxis("Horizontal"); float inputV = InputManager.GetAxis("Vertical"); var move = new Vector3(inputH, 0.0f, inputV); diff --git a/Source/Game/CameraRender.cs b/Source/Game/CameraRender.cs index 65c848d..7c59f0f 100644 --- a/Source/Game/CameraRender.cs +++ b/Source/Game/CameraRender.cs @@ -1,4 +1,6 @@ -using FlaxEditor.Content.Settings; +using System; +using System.Runtime; +using FlaxEditor.Content.Settings; using FlaxEngine; using Console = Cabrito.Console; @@ -52,6 +54,7 @@ namespace Game sceneTask.Output = texture; sceneTask.ViewFlags = ViewFlags.DefaultGame; sceneTask.Enabled = true; + sceneTask.RenderingPercentage = MainRenderTask.Instance.RenderingPercentage; sceneTask2 = new SceneRenderTask(); sceneTask2.Order = -2; @@ -60,12 +63,15 @@ namespace Game sceneTask2.Output = texture2; sceneTask2.ViewFlags = ViewFlags.DefaultGame; sceneTask2.Enabled = true; + sceneTask2.RenderingPercentage = MainRenderTask.Instance.RenderingPercentage; // Setup material instance and parameters if (materialInstance == null) materialInstance = material.CreateVirtualInstance(); materialInstance.SetParameterValue("Input", texture); materialInstance.SetParameterValue("Depth", texture2); + + lastEnabled = true; } public override void OnDestroy() @@ -78,7 +84,7 @@ namespace Game public override PostProcessEffectLocation Location => PostProcessEffectLocation.Default; public override int Order => 110; - public override bool CanRender => true; + public override bool CanRender => camera.IsActive; public override void Render(GPUContext context, ref RenderContext renderContext, GPUTexture input, GPUTexture output) { @@ -88,6 +94,7 @@ namespace Game Renderer.DrawPostFxMaterial(context, ref renderContext, materialInstance, output, input.View()); } + private bool lastEnabled; public override void OnUpdate() { #if FLAX_EDITOR @@ -100,6 +107,15 @@ namespace Game } #endif + if (lastEnabled != camera.IsActive) + { + lastEnabled = camera.IsActive; + sceneTask.Enabled = lastEnabled; + sceneTask2.Enabled = lastEnabled; + sceneTask.RenderingPercentage = MainRenderTask.Instance.RenderingPercentage * 0.5f; + sceneTask2.RenderingPercentage = MainRenderTask.Instance.RenderingPercentage * 0.5f; + } + if (!camera.IsActive) return; if (texture == null) diff --git a/Source/Game/PlayerInputLocal.cs b/Source/Game/PlayerInputLocal.cs index ed5e1b0..0311fc4 100644 --- a/Source/Game/PlayerInputLocal.cs +++ b/Source/Game/PlayerInputLocal.cs @@ -34,6 +34,8 @@ namespace Game // All axis values here should be accumulated currentState.input.viewDeltaX += InputManager.GetAxisRaw("Mouse X"); currentState.input.viewDeltaY += InputManager.GetAxisRaw("Mouse Y"); + currentState.input.viewDeltaX += InputManager.GetAxisRaw("LookRight") * Time.DeltaTime * 100; + currentState.input.viewDeltaY += -InputManager.GetAxisRaw("LookUp") * Time.DeltaTime * 100; currentState.input.moveForward = InputManager.GetAxis("Vertical"); currentState.input.moveRight = InputManager.GetAxis("Horizontal"); diff --git a/Source/Game/PlayerMovement.cs b/Source/Game/PlayerMovement.cs index e9f92ed..ee4f330 100644 --- a/Source/Game/PlayerMovement.cs +++ b/Source/Game/PlayerMovement.cs @@ -960,7 +960,9 @@ namespace Game { // Avoid overlapping with recent landing sound if (Time.GameTime - lastLanded > 0.3) - AudioManager.PlaySound("jumpland", Actor, 0, rootActor.Position, 1f /*, new Vector2(0.7f, 1.3f)*/); + { + PlayJumpLandSound(false, false); + } } return true; @@ -969,7 +971,20 @@ namespace Game private void OnLanded(Vector3 landingVelocity, bool hardLanding) { if (!predicting) - AudioManager.PlaySound("jumpland", Actor, 1, rootActor.Position, hardLanding ? 1.0f : 1.0f/*, new Vector2(0.7f, 1.3f)*/); + PlayJumpLandSound(true, hardLanding); + } + + private void PlayJumpLandSound(bool landing, bool hardLanding) + { + if (!landing) + lastLanded = -1; // Reset so double jumps have double sounds + + float volume = 0.8f; + Vector2 pitchRange = new Vector2(0.9f, 1.05f); + Vector2 secondStepDelayRange = new Vector2(0.031f, 0.067f); + + AudioManager.PlaySound("jumpland", Actor, 0, AudioFlags.None, rootActor.Position, volume , pitchRange); + AudioManager.PlaySoundDelayed(secondStepDelayRange, "jumpland", Actor, 0, rootActor.Position, volume, pitchRange); } private static void ApplyFriction(ref Vector3 velocity) diff --git a/Source/Game/WeaponSway.cs b/Source/Game/WeaponSway.cs index fd5b53c..d4744a2 100644 --- a/Source/Game/WeaponSway.cs +++ b/Source/Game/WeaponSway.cs @@ -7,6 +7,8 @@ namespace Game { public class WeaponSway : Script { + public float swaySpeed = 3000f; + private Actor rootActor; private Actor cameraHolder; public override void OnStart() @@ -16,173 +18,6 @@ namespace Game Actor.LocalOrientation = GetRotation(); } - - float easeInSine( float t ) { - return Mathf.Sin( 1.5707963f * t ); - } - - float easeOutSine( float t ) { - return 1 + Mathf.Sin( 1.5707963f * (--t) ); - } - - float easeInOutSine( float t ) { - return 0.5f * (1 + Mathf.Sin( 3.1415926f * (t - 0.5f) ) ); - } - - float easeInQuad( float t ) { - return t * t; - } - - float easeOutQuad( float t ) { - return t * (2 - t); - } - - float easeInOutQuad( float t ) { - return t < 0.5 ? 2 * t * t : t * (4 - 2 * t) - 1; - } - - float easeInCubic( float t ) { - return t * t * t; - } - - float easeOutCubic( float t ) { - return 1 + (--t) * t * t; - } - - float easeInOutCubic( float t ) { - return t < 0.5 ? 4 * t * t * t : 1 + (--t) * (2 * (--t)) * (2 * t); - } - - float easeInQuart( float t ) { - t *= t; - return t * t; - } - - float easeOutQuart( float t ) { - t = (--t) * t; - return 1 - t * t; - } - - float easeInOutQuart( float t ) { - if( t < 0.5 ) { - t *= t; - return 8 * t * t; - } else { - t = (--t) * t; - return 1 - 8 * t * t; - } - } - - float easeInQuint( float t ) { - float t2 = t * t; - return t * t2 * t2; - } - - float easeOutQuint( float t ) { - float t2 = (--t) * t; - return 1 + t * t2 * t2; - } - - float easeInOutQuint( float t ) { - float t2; - if( t < 0.5 ) { - t2 = t * t; - return 16 * t * t2 * t2; - } else { - t2 = (--t) * t; - return 1 + 16 * t * t2 * t2; - } - } - - float easeInExpo( float t ) { - return (Mathf.Pow( 2, 8 * t ) - 1) / 255; - } - - float easeOutExpo( float t ) { - return 1 - Mathf.Pow( 2, -8 * t ); - } - - float easeInOutExpo( float t ) { - if( t < 0.5 ) { - return (Mathf.Pow( 2, 16 * t ) - 1) / 510; - } else { - return 1 - 0.5f * Mathf.Pow( 2, -16 * (t - 0.5f) ); - } - } - - float easeInCirc( float t ) { - return 1 - Mathf.Sqrt( 1 - t ); - } - - float easeOutCirc( float t ) { - return Mathf.Sqrt( t ); - } - - float easeInOutCirc( float t ) { - if( t < 0.5 ) { - return (1 - Mathf.Sqrt( 1 - 2 * t )) * 0.5f; - } else { - return (1 + Mathf.Sqrt( 2 * t - 1 )) * 0.5f; - } - } - - float easeInBack( float t ) { - return t * t * (2.70158f * t - 1.70158f); - } - - float easeOutBack( float t ) { - return 1 + (--t) * t * (2.70158f * t + 1.70158f); - } - - float easeInOutBack( float t ) { - if( t < 0.5 ) { - return t * t * (7 * t - 2.5f) * 2; - } else { - return 1 + (--t) * t * 2 * (7 * t + 2.5f); - } - } - - float easeInElastic( float t ) { - float t2 = t * t; - return t2 * t2 * Mathf.Sin( t * (float)Math.PI * 4.5f ); - } - - float easeOutElastic( float t ) { - float t2 = (t - 1) * (t - 1); - return 1 - t2 * t2 * Mathf.Cos( t * (float)Math.PI * 4.5f ); - } - - float easeInOutElastic( float t ) { - float t2; - if( t < 0.45 ) { - t2 = t * t; - return 8 * t2 * t2 * Mathf.Sin( t * (float)Math.PI * 9 ); - } else if( t < 0.55 ) { - return 0.5f + 0.75f * Mathf.Sin( t * (float)Math.PI * 4 ); - } else { - t2 = (t - 1) * (t - 1); - return 1 - 8 * t2 * t2 * Mathf.Sin( t * (float)Math.PI * 9 ); - } - } - - float easeInBounce( float t ) { - return Mathf.Pow( 2, 6 * (t - 1) ) * Mathf.Abs( Mathf.Sin( t * (float)Math.PI * 3.5f ) ); - } - - float easeOutBounce( float t ) { - return 1 - Mathf.Pow( 2, -6 * t ) * Mathf.Abs( Mathf.Cos( t * (float)Math.PI * 3.5f ) ); - } - - float easeInOutBounce( float t ) { - if( t < 0.5 ) { - return 8 * Mathf.Pow( 2, 8 * (t - 1) ) * Mathf.Abs( Mathf.Sin( t * (float)Math.PI * 7 ) ); - } else { - return 1 - 8 * Mathf.Pow( 2, -8 * t ) * Mathf.Abs( Mathf.Sin( t * (float)Math.PI * 7 ) ); - } - } - - public float swaySpeed = 15f; - private Quaternion GetRotation() { Quaternion pitch = cameraHolder.LocalOrientation; @@ -190,48 +25,58 @@ namespace Game return yawRoll * pitch; } + private float timeRemainder = 0f; public override void OnLateUpdate() { - //easeInQuad - Quaternion rotation = GetRotation(); Vector3 targetAngles = rotation.EulerAngles; Vector3 angles = Actor.LocalOrientation.EulerAngles; - float swaySpeedScaled = swaySpeed * Time.DeltaTime; - const float maxAngle = 30f; + // Ensure the swaying is smooth when framerate fluctuates slightly + float remaining = Time.DeltaTime + timeRemainder; + const float minTime = 1f / 120f; + do + { + float stepTime = Mathf.Min(Time.DeltaTime, minTime); + remaining -= stepTime; + float swaySpeedScaled = swaySpeed * stepTime; - float deltaX = Mathf.DeltaAngle(angles.X, targetAngles.X); - float deltaY = Mathf.DeltaAngle(angles.Y, targetAngles.Y); - float deltaZ = Mathf.DeltaAngle(angles.Z, targetAngles.Z); - if (deltaX > maxAngle) - angles.X -= maxAngle - deltaX; - else if (deltaX < -maxAngle) - angles.X += maxAngle + deltaX; - if (deltaY > maxAngle) - angles.Y -= maxAngle - deltaY; - else if (deltaY < -maxAngle) - angles.Y += maxAngle + deltaY; - if (deltaZ > maxAngle) - angles.Z -= maxAngle - deltaZ; - else if (deltaZ < -maxAngle) - angles.Z += maxAngle + deltaZ; + float deltaX = Mathf.DeltaAngle(angles.X, targetAngles.X); + float deltaY = Mathf.DeltaAngle(angles.Y, targetAngles.Y); + float deltaZ = Mathf.DeltaAngle(angles.Z, targetAngles.Z); - float percX = Mathf.Abs(deltaX) / maxAngle; - float percY = Mathf.Abs(deltaY) / maxAngle; - float percZ = Mathf.Abs(deltaZ) / maxAngle; - float minSpeed = swaySpeedScaled * 0.00001f; + const float maxAngle = 30f; + if (deltaX > maxAngle) + angles.X -= maxAngle - deltaX; + else if (deltaX < -maxAngle) + angles.X += maxAngle + deltaX; + if (deltaY > maxAngle) + angles.Y -= maxAngle - deltaY; + else if (deltaY < -maxAngle) + angles.Y += maxAngle + deltaY; + if (deltaZ > maxAngle) + angles.Z -= maxAngle - deltaZ; + else if (deltaZ < -maxAngle) + angles.Z += maxAngle + deltaZ; - Func fun = (f) => f*f; + float percX = Mathf.Abs(deltaX) / maxAngle; + float percY = Mathf.Abs(deltaY) / maxAngle; + float percZ = Mathf.Abs(deltaZ) / maxAngle; + float minSpeed = swaySpeedScaled * 0.00001f * 0f; - angles.X = Mathf.MoveTowardsAngle(angles.X, targetAngles.X, Math.Max(swaySpeedScaled*fun(percX), minSpeed)); - angles.Y = Mathf.MoveTowardsAngle(angles.Y, targetAngles.Y, Math.Max(swaySpeedScaled*fun(percY), minSpeed)); - angles.Z = Mathf.MoveTowardsAngle(angles.Z, targetAngles.Z, Math.Max(swaySpeedScaled*fun(percZ), minSpeed)); - //Actor.LocalOrientation = Quaternion.Lerp(Actor.LocalOrientation, rotation, Math.Min(1.0f, easeInCubic(swaySpeed * (1.0f/120f)))); + Func fun = (f) => Mathf.Pow(f, 1.3f); + + angles.X = Mathf.MoveTowardsAngle(angles.X, targetAngles.X, + Math.Max(swaySpeedScaled * fun(percX), minSpeed)); + angles.Y = Mathf.MoveTowardsAngle(angles.Y, targetAngles.Y, + Math.Max(swaySpeedScaled * fun(percY), minSpeed)); + angles.Z = Mathf.MoveTowardsAngle(angles.Z, targetAngles.Z, + Math.Max(swaySpeedScaled * fun(percZ), minSpeed)); + } while (remaining > minTime); + timeRemainder -= remaining; Actor.LocalOrientation = Quaternion.Euler(angles); - } } } diff --git a/asset_sources.txt b/asset_sources.txt index 51ec8a7..7c7d928 100644 --- a/asset_sources.txt +++ b/asset_sources.txt @@ -14,6 +14,9 @@ wateryzap: (Sound-Ideas) [NOT PAID YET] (zap.wav) Ice Frost Spell Skill https://freesound.org/people/EminYILDIRIM/sounds/550266/ water + ice + zap sped up +tele2: + Water Whoosh https://freesound.org/people/EminYILDIRIM/sounds/572025/ + Mage Teleport Skill https://freesound.org/people/EminYILDIRIM/sounds/554791/ magic sfx by EminYILDIRIM: