Two interfaces defining player-related scene events. IPlayerEvent declares callbacks for player lifecycle and actions (spawn, damage, death, jump, land, suicide, pickup, camera hooks) with parameter structs for damage and death. ILocalPlayerEvent declares broadcast events for the local player (jump, land, pickup).
/// <summary>
/// Called only on the Player's GameObject for their actions or events
/// </summary>
public interface IPlayerEvent : ISceneEvent<IPlayerEvent>
{
void OnSpawned() { }
public struct DamageParams
{
public float Damage { get; set; }
public GameObject Attacker { get; set; }
public GameObject Weapon { get; set; }
public TagSet Tags { get; set; }
public Vector3 Position { get; set; }
public Vector3 Origin { get; set; }
}
void OnDamage( DamageParams args ) { }
public struct DiedParams
{
public GameObject Attacker { get; set; }
}
void OnDied( DiedParams args ) { }
void OnJump() { }
void OnLand( float distance, Vector3 velocity ) { }
void OnSuicide() { }
void OnPickup( BaseInventoryItem item ) { }
void OnCameraMove( ref Angles angles ) { }
void OnCameraSetup( CameraComponent camera ) { }
void OnCameraPostSetup( CameraComponent camera ) { }
}
/// <summary>
/// Broadcasted to the entire scene on the local player's actions or events
/// </summary>
public interface ILocalPlayerEvent : ISceneEvent<ILocalPlayerEvent>
{
void OnJump() { }
void OnLand( float distance, Vector3 velocity ) { }
void OnPickup( BaseInventoryItem item ) { }
}