Table of Contents

Class Hazard

Namespace
Exiled.API.Features.Hazards
Assembly
Exiled.API.dll

A wrapper for Hazards.EnvironmentalHazard.

public class Hazard : TypeCastObject<Hazard>, IWrapper<EnvironmentalHazard>
Inheritance
Hazard
Implements
IWrapper<EnvironmentalHazard>
Derived
Inherited Members
Extension Methods

Constructors

Hazard(EnvironmentalHazard)

Initializes a new instance of the Hazard class.

public Hazard(EnvironmentalHazard hazard)

Parameters

hazard EnvironmentalHazard

The Hazards.EnvironmentalHazard instance.

Properties

AffectedPlayers

Gets or sets the list with all affected by this hazard players.

public IEnumerable<Player> AffectedPlayers { get; set; }

Property Value

IEnumerable<Player>

Base

Gets the Hazards.EnvironmentalHazard.

public EnvironmentalHazard Base { get; }

Property Value

EnvironmentalHazard

IsActive

Gets a value indicating whether hazard is active.

public bool IsActive { get; }

Property Value

bool

List

Gets the list of all hazards.

public static IReadOnlyCollection<Hazard> List { get; }

Property Value

IReadOnlyCollection<Hazard>

MaxDistance

Gets or sets max hazard distance.

public float MaxDistance { get; set; }

Property Value

float

MaxHeightDistance

Gets or sets max hazard height.

public float MaxHeightDistance { get; set; }

Property Value

float

Position

Gets or sets the position.

public Vector3 Position { get; set; }

Property Value

Vector3

PositionOffset

Gets or sets offset for position.

public Vector3 PositionOffset { get; set; }

Property Value

Vector3

Room

Gets the room where this hazard is located.

public Room Room { get; }

Property Value

Room

Type

Gets the HazardType associated with the current Hazard.

public virtual HazardType Type { get; }

Property Value

HazardType

Methods

Get(HazardType)

Gets an IEnumerable<T> of Hazard.

public static IEnumerable<Hazard> Get(HazardType type)

Parameters

type HazardType

The HazardType to get.

Returns

IEnumerable<Hazard>

IEnumerable<T> of Hazard based on type.

Get(Room)

Gets the hazard by the room where it's located.

public static Hazard Get(Room room)

Parameters

room Room

Room.

Returns

Hazard

Hazard in given Room.

Get(EnvironmentalHazard)

Gets the Hazard by Hazards.EnvironmentalHazard.

public static Hazard Get(EnvironmentalHazard environmentalHazard)

Parameters

environmentalHazard EnvironmentalHazard

The Hazards.EnvironmentalHazard instance.

Returns

Hazard

Hazard for Hazards.EnvironmentalHazard.

Get(Func<Hazard, bool>)

Gets the IEnumerable<T> of Hazard based on predicate.

public static IEnumerable<Hazard> Get(Func<Hazard, bool> predicate)

Parameters

predicate Func<Hazard, bool>

Condition to satisfy.

Returns

IEnumerable<Hazard>

IEnumerable<T> of Hazard based on predicate.

Get(GameObject)

Gets the hazard by it's UnityEngine.GameObject.

public static Hazard Get(GameObject obj)

Parameters

obj GameObject

Game object.

Returns

Hazard

Hazard in given Room.

Get<T>(EnvironmentalHazard)

Gets the Hazard by Hazards.EnvironmentalHazard.

public static T Get<T>(EnvironmentalHazard environmentalHazard) where T : Hazard

Parameters

environmentalHazard EnvironmentalHazard

The Hazards.EnvironmentalHazard to convert into an hazard.

Returns

T

The hazard wrapper for the given Hazards.EnvironmentalHazard.

Type Parameters

T

The specified Hazard type.

IsInArea(Player)

Checks if player is in hazard zone.

public bool IsInArea(Player player)

Parameters

player Player

Player to check.

Returns

bool

true if player is in hazard zone. Otherwise, false.