Class Projectile
- Namespace
- Exiled.API.Features.Pickups.Projectiles
- Assembly
- Exiled.API.dll
A wrapper class for Projectile.
public class Projectile : Pickup, IWrapper<ItemPickupBase>, IWorldSpace, IPosition, IRotation, IWrapper<ThrownProjectile>
- Inheritance
-
Projectile
- Derived
- Inherited Members
- Extension Methods
Properties
Base
Gets the InventorySystem.Items.ThrowableProjectiles.ThrownProjectile that this class is encapsulating.
public ThrownProjectile Base { get; }
Property Value
- ThrownProjectile
ProjectileType
Gets the ProjectileType of the item.
public ProjectileType ProjectileType { get; }
Property Value
Methods
Activate()
Activates the current Projectile.
public void Activate()
Create(ProjectileType)
Creates and returns a new Projectile with the proper inherited subclass.
Based on the projectiletype
, the returned Projectile can be casted into a subclass to gain more control over the object.
The following have their own respective classes:
- FragGrenade can be casted to ExplosionGrenadeProjectile.
- Flashbang can be casted to FlashbangProjectile.
- Scp018 A and B variants can be casted to Scp018Projectile.
- Scp2176 can be casted to Scp2176Projectile.
Projectile that are not listed will cause an Exception.
public static Projectile Create(ProjectileType projectiletype)
Parameters
projectiletype
ProjectileTypeThe ProjectileType of the projectile.
Returns
- Projectile
The created Projectile.
CreateAndSpawn(ProjectileType, Vector3, Quaternion?, bool, Player)
Creates and spawns a Projectile.
public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null)
Parameters
type
ProjectileTypeThe ProjectileType of the projectile.
position
Vector3The position to spawn the Projectile at.
rotation
Quaternion?The rotation to spawn the Projectile.
shouldBeActive
boolWhether the Projectile should be in active state after spawn.
previousOwner
PlayerAn optional previous owner of the item.
Returns
- Projectile
The Projectile. See documentation of Create(ProjectileType) for more information on casting.
CreateAndSpawn<T>(ProjectileType, Vector3, Quaternion?, bool, Player)
Creates and spawns a Projectile.
public static Projectile CreateAndSpawn<T>(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) where T : Projectile
Parameters
type
ProjectileTypeThe ProjectileType of the projectile.
position
Vector3The position to spawn the Projectile at.
rotation
Quaternion?The rotation to spawn the Projectile.
shouldBeActive
boolWhether the Projectile should be in active state after spawn.
previousOwner
PlayerAn optional previous owner of the item.
Returns
- Projectile
The Projectile. See documentation of Create(ProjectileType) for more information on casting.
Type Parameters
T
The specified Projectile type.
Create<T>(ProjectileType)
Creates and returns a new Projectile with the proper inherited subclass.
Based on the projectiletype
, the returned Projectile can be casted into a subclass to gain more control over the object.
The following have their own respective classes:
- FragGrenade can be casted to ExplosionGrenadeProjectile.
- Flashbang can be casted to FlashbangProjectile.
- Scp018 A and B variants can be casted to Scp018Projectile.
- Scp2176 can be casted to Scp2176Projectile.
Projectile that are not listed will cause an Exception.
public static Projectile Create<T>(ProjectileType projectiletype) where T : Projectile
Parameters
projectiletype
ProjectileTypeThe ProjectileType of the projectile.
Returns
- Projectile
The created Projectile.
Type Parameters
T
The specified Projectile type.
Spawn(Vector3, Quaternion?, bool, Player)
Spawns a Projectile.
public Projectile Spawn(Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null)
Parameters
position
Vector3The position to spawn the Projectile at.
rotation
Quaternion?The rotation to spawn the Projectile.
shouldBeActive
boolWhether the Projectile should be in active state after spawn.
previousOwner
PlayerAn optional previous owner of the item.
Returns
- Projectile
The spawned Projectile.
ToString()
Returns the ProjectilePickup in a human readable format.
public override string ToString()
Returns
- string
A string containing ProjectilePickup-related data.