aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.sbproj2
-rw-r--r--code/pawn/component/movement/PlayerController.cs12
-rw-r--r--code/phase/PlayPhase.cs16
-rw-r--r--code/phase/WaitPhase.cs15
-rw-r--r--code/ui/health/Health.razor13
-rw-r--r--sounds/fall.sound12
-rw-r--r--sounds/fall.wavbin0 -> 53718 bytes
7 files changed, 55 insertions, 15 deletions
diff --git a/.sbproj b/.sbproj
index 6172332..2accd0b 100644
--- a/.sbproj
+++ b/.sbproj
@@ -1,5 +1,5 @@
{
- "Title": "Murder Mystery",
+ "Title": "Murder",
"Type": "game",
"Org": "leonardobishop",
"Ident": "murder",
diff --git a/code/pawn/component/movement/PlayerController.cs b/code/pawn/component/movement/PlayerController.cs
index 885bf84..2c9a9b9 100644
--- a/code/pawn/component/movement/PlayerController.cs
+++ b/code/pawn/component/movement/PlayerController.cs
@@ -36,8 +36,18 @@ public class PlayerController : EntityComponent<Player>
{
if ( !Grounded )
{
- Entity.Velocity = Entity.Velocity.WithZ( 0 );
+ var zVel = Entity.Velocity.z;
AddEvent( "grounded" );
+ Entity.Velocity = Entity.Velocity.WithZ( 0 );
+
+ if (zVel < -500)
+ {
+ var damageInfo = DamageInfo.Generic( Math.Abs((float)(zVel * 0.05)) );
+ Entity.TakeDamage( damageInfo );
+ Entity.PlaySound( "fall" );
+ return;
+ }
+
}
var sprintMultiplier = TeamOperations.CanSprint( team ) ? (Input.Down( "run" ) ? 2.5f : 1f) : 1f;
diff --git a/code/phase/PlayPhase.cs b/code/phase/PlayPhase.cs
index b6210b3..8b4ff7f 100644
--- a/code/phase/PlayPhase.cs
+++ b/code/phase/PlayPhase.cs
@@ -98,18 +98,24 @@ public class PlayPhase : BasePhase
[MurderEvent.Kill]
public void OnKill(Entity killer, Entity victim)
{
- if (killer == null || killer is not Player || victim == null || victim is not Player )
+ if (killer is not Player && victim is not Player )
{
return;
}
Player victimPlayer = (Player)victim;
- Player killerPlayer = (Player)killer;
-
Team victimTeam = victimPlayer.CurrentTeam;
- Team killerTeam = killerPlayer.CurrentTeam;
-
victimPlayer.CurrentTeam = Team.Spectator;
+ if (killer == null)
+ {
+ Log.Info( victimPlayer + " died mysteriously" );
+ return;
+ }
+
+
+ Player killerPlayer = (Player)killer;
+ Team killerTeam = killerPlayer.CurrentTeam;
+
Log.Info( victimPlayer + " died to " + killerPlayer );
if (victimTeam != Team.Murderer && killerTeam != Team.Murderer)
diff --git a/code/phase/WaitPhase.cs b/code/phase/WaitPhase.cs
index 9eab094..6014467 100644
--- a/code/phase/WaitPhase.cs
+++ b/code/phase/WaitPhase.cs
@@ -52,21 +52,26 @@ public class WaitPhase : BasePhase
pawn.Transform = tx;
}
- pawn.CurrentTeam = Team.Bystander;
pawn.Spawn();
- pawn.Respawn();
+ RespawnPlayer( pawn );
} else
{
var pawn = (Player)client.Pawn;
- if (pawn.LifeState == LifeState.Dead)
+ if (pawn.LifeState == LifeState.Dead && pawn.TimeSinceDeath > 3)
{
- pawn.CurrentTeam = Team.Bystander;
- pawn.Respawn();
+ RespawnPlayer( pawn );
}
}
}
}
+ private void RespawnPlayer(Player pawn)
+ {
+ pawn.CurrentTeam = Team.Spectator;
+ pawn.DressFromClient( pawn.Client );
+ pawn.Respawn();
+ }
+
public override void HandleClientJoin( ClientJoinedEvent e )
{
diff --git a/code/ui/health/Health.razor b/code/ui/health/Health.razor
index 3da2c01..c3c6660 100644
--- a/code/ui/health/Health.razor
+++ b/code/ui/health/Health.razor
@@ -10,12 +10,19 @@ Health {
height: 100%;
background-color: rgba(0, 0, 0, 0.90);
}
-.fill {
+.colour-bar {
height: 100%;
- transition: width 0.2s ease-out;
+}
+.transition-bar {
+ height: 100%;
+ transition: width 1s ease-out 0.5s;
+ position: absolute;
+ top: 0;
+ left: 0;
}
</style>
-<div class="fill" style="background-color: @(Colour); width: @(GetHealth())%;"></div>
+<div class="transition-bar" style="background-color: white; width: @(GetHealth())%;"></div>
+<div class="colour-bar" style="background-color: @(Colour); width: @(GetHealth())%;"></div>
@code
{
diff --git a/sounds/fall.sound b/sounds/fall.sound
new file mode 100644
index 0000000..9d35ab9
--- /dev/null
+++ b/sounds/fall.sound
@@ -0,0 +1,12 @@
+{
+ "UI": false,
+ "Volume": "1.00,1.00,0",
+ "Pitch": "1.00,1.00,0",
+ "Decibels": 70,
+ "SelectionMode": "Random",
+ "Sounds": [
+ "sounds/fall.vsnd"
+ ],
+ "MaximumDistance": 1143.9335,
+ "MinimumDistance": 57.196674
+} \ No newline at end of file
diff --git a/sounds/fall.wav b/sounds/fall.wav
new file mode 100644
index 0000000..c3d5a8e
--- /dev/null
+++ b/sounds/fall.wav
Binary files differ