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
projectiletypeProjectileTypeThe 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
typeProjectileTypeThe ProjectileType of the projectile.
positionVector3The position to spawn the Projectile at.
rotationQuaternion?The rotation to spawn the Projectile.
shouldBeActiveboolWhether the Projectile should be in active state after spawn.
previousOwnerPlayerAn 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 T CreateAndSpawn<T>(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) where T : Projectile
Parameters
typeProjectileTypeThe ProjectileType of the projectile.
positionVector3The position to spawn the Projectile at.
rotationQuaternion?The rotation to spawn the Projectile.
shouldBeActiveboolWhether the Projectile should be in active state after spawn.
previousOwnerPlayerAn optional previous owner of the item.
Returns
- T
The Projectile. See documentation of Create(ProjectileType) for more information on casting.
Type Parameters
TThe 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 T Create<T>(ProjectileType projectiletype) where T : Projectile
Parameters
projectiletypeProjectileTypeThe ProjectileType of the projectile.
Returns
- T
The created Projectile.
Type Parameters
TThe 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
positionVector3The position to spawn the Projectile at.
rotationQuaternion?The rotation to spawn the Projectile.
shouldBeActiveboolWhether the Projectile should be in active state after spawn.
previousOwnerPlayerAn 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.