jutkuja
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using FlaxEngine.Assertions;
|
||||
using Console = Cabrito.Console;
|
||||
using Object = FlaxEngine.Object;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -254,6 +255,7 @@ namespace Game
|
||||
if (traceDown.fraction < 1f && -Vector3.Dot(Physics.Gravity.Normalized, traceDown.hitNormal) < 0.7)
|
||||
{
|
||||
// can't step down, slide move like normally
|
||||
Console.Print("no stepping 1, frac: " + traceDown.fraction.ToString() + ", dot: " + (-Vector3.Dot(Physics.Gravity.Normalized, traceDown.hitNormal)).ToString() + ", norm: " + traceDown.hitNormal.ToString());
|
||||
position = slidePosition;
|
||||
velocity = slideVelocity;
|
||||
return slideMoveHit;
|
||||
@@ -269,6 +271,7 @@ namespace Game
|
||||
if (d1 < d2)
|
||||
{
|
||||
// ?
|
||||
Console.Print("no stepping 2, " + d1.ToString() + " < " + d2.ToString());
|
||||
position = slidePosition;
|
||||
velocity = slideVelocity;
|
||||
return slideMoveHit;
|
||||
@@ -284,6 +287,7 @@ namespace Game
|
||||
// choose which one went furthest away from the original position
|
||||
if ((stepPosition2 - originalPosition).Length < (slidePosition2 - originalPosition).Length)
|
||||
{
|
||||
Console.Print("no stepping 3");
|
||||
position = slidePosition;
|
||||
velocity = slideVelocity;
|
||||
return slideMoveHit;
|
||||
@@ -553,6 +557,26 @@ namespace Game
|
||||
|
||||
velocity += Vector3.Up * jumpVelocity;
|
||||
onGround = false;
|
||||
|
||||
Guid jumpguid;
|
||||
FlaxEngine.Json.JsonSerializer.ParseID("1ef4565844a4b36cdfda54b51f338c77", out jumpguid);
|
||||
AudioClip jumpAsset = AudioClip.Find<AudioClip>(ref jumpguid);
|
||||
if (jumpAsset != null && jumpAsset.IsLoaded)
|
||||
{
|
||||
var audioSource = new AudioSource();
|
||||
audioSource.Clip = jumpAsset;
|
||||
audioSource.Position = rootActor.Position;//new Vector3(-350, 176, 61);//rootActor.Position;
|
||||
audioSource.Parent = Actor.Parent;
|
||||
|
||||
|
||||
audioSource.Play();
|
||||
Destroy(audioSource, jumpAsset.Length);
|
||||
Console.Print("jumping sound!");
|
||||
}
|
||||
else if (jumpAsset == null)
|
||||
Console.Print("jumpAsset not found");
|
||||
else
|
||||
Console.Print("jumpAsset not loaded");
|
||||
}
|
||||
else if (jumped) // jump released
|
||||
jumped = false;
|
||||
|
||||
Reference in New Issue
Block a user