mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Sync sounds with leg animations when applicable.
This commit is contained in:
parent
81689a65d9
commit
c32891d868
@ -117,14 +117,25 @@ namespace ClassicalSharp {
|
|||||||
bool anyNonAir = false;
|
bool anyNonAir = false;
|
||||||
SoundType type = GetSoundUnder( ref anyNonAir );
|
SoundType type = GetSoundUnder( ref anyNonAir );
|
||||||
if( !anyNonAir ) soundPos = new Vector3( -100000 );
|
if( !anyNonAir ) soundPos = new Vector3( -100000 );
|
||||||
|
|
||||||
float distSq = (lastSoundPos - soundPos).LengthSquared;
|
if( onGround && (DoPlaySound( soundPos ) || !wasOnGround) ) {
|
||||||
if( onGround && (distSq > 1.75f * 1.75f || !wasOnGround) ) {
|
|
||||||
game.AudioPlayer.PlayStepSound( type );
|
game.AudioPlayer.PlayStepSound( type );
|
||||||
lastSoundPos = soundPos;
|
lastSoundPos = soundPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DoPlaySound( Vector3 soundPos ) {
|
||||||
|
float distSq = (lastSoundPos - soundPos).LengthSquared;
|
||||||
|
// just play every certain block interval when not animating
|
||||||
|
if( curSwing < 0.999f )
|
||||||
|
return distSq > 1.75f * 1.75f;
|
||||||
|
|
||||||
|
// have our legs just crossed over the '0' point?
|
||||||
|
float oldLegRot = (float)Math.Sin( walkTimeO );
|
||||||
|
float newLegRot = (float)Math.Sin( walkTimeN );
|
||||||
|
return Math.Sign( oldLegRot ) != Math.Sign( newLegRot );
|
||||||
|
}
|
||||||
|
|
||||||
SoundType GetSoundUnder( ref bool anyNonAir ) {
|
SoundType GetSoundUnder( ref bool anyNonAir ) {
|
||||||
Vector3 pos = new Vector3( nextPos.X, nextPos.Y - 0.01f, nextPos.Z );
|
Vector3 pos = new Vector3( nextPos.X, nextPos.Y - 0.01f, nextPos.Z );
|
||||||
Vector3 size = CollisionSize;
|
Vector3 size = CollisionSize;
|
||||||
|
@ -73,8 +73,8 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawClassicube() {
|
void DrawClassicube() {
|
||||||
MakeLabelAt( "Username", titleFont, Anchor.Centre, Anchor.Centre, -180, -150 );
|
MakeLabelAt( "Username", titleFont, Anchor.Centre, Anchor.Centre, -170, -150 );
|
||||||
MakeLabelAt( "Password", titleFont, Anchor.Centre, Anchor.Centre, -180, -100 );
|
MakeLabelAt( "Password", titleFont, Anchor.Centre, Anchor.Centre, -170, -100 );
|
||||||
|
|
||||||
MakeInput( Get(), 280, Anchor.Centre, false, 30, -150, 32 );
|
MakeInput( Get(), 280, Anchor.Centre, false, 30, -150, 32 );
|
||||||
MakeInput( Get(), 280, Anchor.Centre, true, 30, -100, 32 );
|
MakeInput( Get(), 280, Anchor.Centre, true, 30, -100, 32 );
|
||||||
|
@ -10,7 +10,7 @@ namespace Launcher2 {
|
|||||||
//new FastColour( 104, 87, 119 );
|
//new FastColour( 104, 87, 119 );
|
||||||
|
|
||||||
public static FastColour ButtonBackCol = new FastColour( 97, 81, 110 );
|
public static FastColour ButtonBackCol = new FastColour( 97, 81, 110 );
|
||||||
public static FastColour ButtonForeActiveCol = new FastColour( 185, 162, 204 );
|
public static FastColour ButtonForeActiveCol = new FastColour( 189, 168, 206 );
|
||||||
public static FastColour ButtonForeCol = new FastColour( 164, 138, 186 );
|
public static FastColour ButtonForeCol = new FastColour( 164, 138, 186 );
|
||||||
public static FastColour ButtonHighlightCol = new FastColour( 182, 158, 201 );
|
public static FastColour ButtonHighlightCol = new FastColour( 182, 158, 201 );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user