new jumpland sound system, showweapon cvar, smooth weapon sway
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Assets/Audio/step5.wav
Normal file
BIN
Assets/Audio/step5.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/step6.wav
Normal file
BIN
Assets/Audio/step6.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/step7.wav
Normal file
BIN
Assets/Audio/step7.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/step8.wav
Normal file
BIN
Assets/Audio/step8.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/step9.wav
Normal file
BIN
Assets/Audio/step9.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/tele2.wav
Normal file
BIN
Assets/Audio/tele2.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/tele_water.wav
Normal file
BIN
Assets/Audio/tele_water.wav
Normal file
Binary file not shown.
BIN
Assets/Audio/tele_woosh.wav
Normal file
BIN
Assets/Audio/tele_woosh.wav
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Audio/jumpland_var6.flax
Normal file
BIN
Content/Audio/jumpland_var6.flax
Normal file
Binary file not shown.
BIN
Content/Audio/jumpland_var7.flax
Normal file
BIN
Content/Audio/jumpland_var7.flax
Normal file
Binary file not shown.
BIN
Content/Audio/jumpland_var8.flax
Normal file
BIN
Content/Audio/jumpland_var8.flax
Normal file
Binary file not shown.
BIN
Content/Audio/jumpland_var9.flax
Normal file
BIN
Content/Audio/jumpland_var9.flax
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
},
|
||||
|
||||
Binary file not shown.
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<float, float> 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<float, float> 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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user