Библиотеки

список библиотек s&box

Game Events

facepunch.libevents

Strongly typed game events

Описание

About Game Events

Easily dispatch events in your scene when stuff happens.

Basics

Declare an event type implementing with all the properties you want to pass around.

public record DamagedEvent(
GameObject Attacker,
GameObject Victim,
int Damage ) : IGameEvent;

Implement for your custom event type in a .

public sealed class MyComponent : Component,
IGameEventHandler<DamagedEvent>
{
public void OnGameEvent( DamagedEvent eventArgs )
{
Log.Info( $"{eventArgs.Victim.Name} says \"Ouch!\"" );
}
}

Dispatch the event on a or the , which will notify any components in its descendants.

GameObject.Dispatch( new DamagedEvent( attacker, victim, 50 ) );

Invocation order

You can control the order that handlers are invoked using attributes on the handler method.

* : run this first
* : run this last
* : run this before 's handler
* : run this after 's handler

[Early, After<SomeOtherComponent>]
public void OnGameEvent( DamagedEvent eventArgs )
{
Log.Info( $"{eventArgs.Victim.Name} says \"Ouch!\"" );
}

02
Миниатюра SDF Mesh Library
SDF Mesh Library facepunch.libsdf

Marching cubes & squares mesh generation

+0 24 ч
30избранное
25положительные оценки
90%Terry Score
03
Миниатюра Sprite Tools (OBSOLETE)
Sprite Tools (OBSOLETE) facepunch.spritetools

Do not use anymore, SpriteRenderer and Sprite Resource are built-in now.

+0 24 ч
18избранное
22положительные оценки
83%Terry Score
05
Миниатюра Spline Tools
Spline Tools facepunch.splinetools

Work In Progress Spline Tools.

+0 24 ч
12избранное
17положительные оценки
86%Terry Score