Globum Nix

screenshot of the main menu

Globum Nix is an online-multiplayer first-person, team-based snowball fighting game. Created in Unity 5.0.

My contributions

class Health : NetBehaviour
{
    // Reliable SyncVars are only transmitted on change and sent reliably.
    // Unreliable SyncVars are continuously transmitted but individual,
    // updates may be missed.
    [SyncVar(SendMethod.Reliable)]
    private int _health;

    private NetMethod<Action<Vector3>> _spawnParticle;

    protected internal override void NetAwake()
    {
        _spawnParticle = NetMethod.Create<Vector3>(position);
        _health = 100;
    }

    public void OnTakeDamage()
    {
        // Asserts that this is running on the server
        NetContext.Server();

        // [SyncVar] takes care of the synchronization
        _health -= 1;
        // RPC that runs on all clients, with a single parameter
        _spawnParticle.OnClients()(transform.position);
    }


    [NetMethod(SendMethod.Reliable)]
    private void SpawnParticle(Vector3 position)
    {
        // Asserts that this runs on clients only
        NetContext.Client();
        // ...
    }
}
screenshot of an area before terrain deformation screenshot of an area after terrain deformation