Skip to content
EvilEngine.Api.Crosshair

ICrosshair interface

public interface ICrosshair

One crosshair, everyone’s or one player’s (ICrosshairs): the layers over it and the motion played on it.

Layers stay until cleared and reach the player as soon as they change. Events, reactions, holds and releases play once, in the player’s next snapshot, and ease on their screen at its frame rate. Every method throws ArgumentException naming what’s wrong when what it’s given isn’t a layer, a name or a reaction.

crosshair.Play("shot");
crosshair.Hold("reload");
crosshair.Release("reload");
Assembly
EvilEngine.Api
Commit
4ff877b1

Members

Layers property

IReadOnlyList<CrosshairLayer> Layers { get; }

The layers set on this crosshair, in the order they were set. What the player sees stacks them by priority over everyone’s.

Set method

void Set(CrosshairLayer layer)

Sets a CrosshairLayer, replacing the one with the same Source. Setting one equal to what’s there sends nothing.

Clear method

bool Clear(string source)

Drops the layer with that source, and with it its locks. Returns false when there was none.

Play method

void Play(string name)
void Play(CrosshairReaction reaction)

Plays a reaction once. Given an event name, shot, reload or a name of your own, it plays the shown style’s reaction to that event from its record’s on table, and nothing when the style has none, so Garry’s Mod’s styles stay still as Garry’s Mod’s do. Given a CrosshairReaction, it plays that whatever the style.

An event name is lowercase letters, digits, _ and ., starting with a letter, at most 64 long.

Hold method

void Hold(string name)
void Hold(string key, CrosshairReaction reaction)

Rises to a reaction’s peak and stays there until Release with the same key, as a reload dims the crosshair for as long as it lasts. Given only a name, it holds the shown style’s reaction to that event under that name. Holding a key already held does nothing; holding one that’s easing back picks up from where it is.

Release method

void Release(string key)

Eases a held reaction back over its release seconds from wherever it is. Releasing a key nothing holds does nothing.