TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.PhysicsProjectile Class Reference

Use this class for physics based projectiles (meant to be thrown by a ProjectileWeapon) More...

Inheritance diagram for MoreMountains.TopDownEngine.PhysicsProjectile:
MoreMountains.TopDownEngine.Projectile MoreMountains.Tools.MMPoolableObject MoreMountains.Tools.MMObjectBounds

Public Member Functions

override void Movement ()
 Handles the projectile's movement, every frame.
override void SetDirection (Vector3 newDirection, Quaternion newRotation, bool spawnerIsFacingRight=true)
 Sets the projectile's direction.
Public Member Functions inherited from MoreMountains.TopDownEngine.Projectile
virtual void SetWeapon (Weapon newWeapon)
 Sets the projectile's parent weapon.
virtual void SetDamage (float minDamage, float maxDamage)
 Sets the damage caused by the projectile's DamageOnTouch to the specified value.
virtual void SetOwner (GameObject newOwner)
 Sets the projectile's owner.
virtual GameObject GetOwner ()
 Returns the current Owner of the projectile.
virtual void StopAt ()
 On death, disables colliders and prevents movement.
Public Member Functions inherited from MoreMountains.Tools.MMPoolableObject
delegate void Events ()
virtual void Destroy ()
 Turns the instance inactive, in order to eventually reuse it.
virtual void TriggerOnSpawnComplete ()
 Triggers the on spawn complete event.
Public Member Functions inherited from MoreMountains.Tools.MMObjectBounds
virtual Bounds GetBounds ()
 Returns the bounds of the object, based on what has been defined.

Public Attributes

float InitialForce = 10f
Vector3 InitialRotation = Vector3.zero
ForceMode InitialForceMode = ForceMode.Impulse
ForceMode2D InitialForceMode2D = ForceMode2D.Impulse
Public Attributes inherited from MoreMountains.TopDownEngine.Projectile
bool FaceDirection = true
 if true, the projectile will rotate at initialization towards its rotation
bool FaceMovement = false
 if true, the projectile will rotate towards movement
MovementVectors MovementVector = MovementVectors.Forward
 if FaceMovement is true, the projectile's vector specified below will be aligned to the movement vector, usually you'll want to go with Forward in 3D, Right in 2D
float Speed = 0
 the speed of the object (relative to the level's speed)
float Acceleration = 0
 the acceleration of the object over time. Starts accelerating on enable.
Vector3 Direction = Vector3.left
 the current direction of the object
bool DirectionCanBeChangedBySpawner = true
 if set to true, the spawner can change the direction of the object. If not the one set in its inspector will be used.
Vector3 FlipValue = new Vector3(-1,1,1)
 the flip factor to apply if and when the projectile is mirrored
bool ProjectileIsFacingRight = true
 set this to true if your projectile's model (or sprite) is facing right, false otherwise
float InitialInvulnerabilityDuration =0f
 the initial delay during which the projectile can't be destroyed
bool DamageOwner = false
 should the projectile damage its owner?
Public Attributes inherited from MoreMountains.Tools.MMPoolableObject
UnityEvent ExecuteOnEnable
UnityEvent ExecuteOnDisable
float LifeTime = 0f
 The life time, in seconds, of the object. If set to 0 it'll live forever, if set to any positive value it'll be set inactive after that time.
Public Attributes inherited from MoreMountains.Tools.MMObjectBounds
WaysToDetermineBounds BoundsBasedOn

Protected Member Functions

virtual void SetRigidbody (bool state)
 Sets the associated rb or rb2D to kinematic or not depending on the state.
override void OnEnable ()
 On enable, we force our rb to not be kinematic.
override void OnDisable ()
 On disable, we force our rb to be kinematic to kill any remaining velocity.
Protected Member Functions inherited from MoreMountains.TopDownEngine.Projectile
virtual void Awake ()
 On awake, we store the initial speed of the object.
virtual IEnumerator InitialInvulnerability ()
 Handles the projectile's initial invincibility.
virtual void Initialization ()
 Initializes the projectile.
virtual void FixedUpdate ()
 On update(), we move the object based on the level's speed and the object's speed, and apply acceleration.
virtual void Flip ()
 Flip the projectile.
virtual void Flip (bool state)
 Flip the projectile.
virtual void OnDeath ()
 On death, we stop our projectile.
override void OnEnable ()
 On enable, we trigger a short invulnerability.
override void OnDisable ()
 On disable, we plug our OnDeath method to the health component.
Protected Member Functions inherited from MoreMountains.Tools.MMPoolableObject
virtual void Update ()
 Called every frame.
Protected Member Functions inherited from MoreMountains.Tools.MMObjectBounds
virtual void Reset ()
 When this component is added we define its bounds.
virtual void DefineBoundsChoice ()
 Tries to determine automatically what the bounds should be based on. In this order, it'll keep the last found of these : Collider2D, Collider or Renderer. If none of these is found, it'll be set as Undefined.

Additional Inherited Members

Public Types inherited from MoreMountains.TopDownEngine.Projectile
enum  MovementVectors { Forward , Right , Up }
Public Types inherited from MoreMountains.Tools.MMObjectBounds
enum  WaysToDetermineBounds { Collider , Collider2D , Renderer , Undefined }
Protected Attributes inherited from MoreMountains.TopDownEngine.Projectile
Weapon _weapon
GameObject _owner
Vector3 _movement
float _initialSpeed
SpriteRenderer _spriteRenderer
DamageOnTouch _damageOnTouch
WaitForSeconds _initialInvulnerabilityDurationWFS
Collider _collider
Collider2D _collider2D
Rigidbody _rigidBody
Rigidbody2D _rigidBody2D
bool _facingRightInitially
bool _initialFlipX
Vector3 _initialLocalScale
bool _shouldMove = true
Health _health
bool _spawnerIsFacingRight
Properties inherited from MoreMountains.TopDownEngine.Projectile
virtual DamageOnTouch TargetDamageOnTouch [get]
 Returns the associated damage on touch zone.
virtual Weapon SourceWeapon [get]
Properties inherited from MoreMountains.Tools.MMObjectBounds
virtual Vector3 Size [get, set]
Events inherited from MoreMountains.Tools.MMPoolableObject
Events OnSpawnComplete

Detailed Description

Use this class for physics based projectiles (meant to be thrown by a ProjectileWeapon)

Member Function Documentation

◆ Movement()

override void MoreMountains.TopDownEngine.PhysicsProjectile.Movement ( )
virtual

Handles the projectile's movement, every frame.

Reimplemented from MoreMountains.TopDownEngine.Projectile.

◆ OnDisable()

override void MoreMountains.TopDownEngine.PhysicsProjectile.OnDisable ( )
protectedvirtual

On disable, we force our rb to be kinematic to kill any remaining velocity.

Reimplemented from MoreMountains.Tools.MMPoolableObject.

◆ OnEnable()

override void MoreMountains.TopDownEngine.PhysicsProjectile.OnEnable ( )
protectedvirtual

On enable, we force our rb to not be kinematic.

Reimplemented from MoreMountains.Tools.MMPoolableObject.

◆ SetDirection()

override void MoreMountains.TopDownEngine.PhysicsProjectile.SetDirection ( Vector3 newDirection,
Quaternion newRotation,
bool spawnerIsFacingRight = true )
virtual

Sets the projectile's direction.

Parameters
newDirectionNew direction.
newRotationNew rotation.
spawnerIsFacingRightIf set to true spawner is facing right.

Reimplemented from MoreMountains.TopDownEngine.Projectile.

◆ SetRigidbody()

virtual void MoreMountains.TopDownEngine.PhysicsProjectile.SetRigidbody ( bool state)
protectedvirtual

Sets the associated rb or rb2D to kinematic or not depending on the state.

Parameters
state

Member Data Documentation

◆ InitialForce

float MoreMountains.TopDownEngine.PhysicsProjectile.InitialForce = 10f

◆ InitialForceMode

ForceMode MoreMountains.TopDownEngine.PhysicsProjectile.InitialForceMode = ForceMode.Impulse

◆ InitialForceMode2D

ForceMode2D MoreMountains.TopDownEngine.PhysicsProjectile.InitialForceMode2D = ForceMode2D.Impulse

◆ InitialRotation

Vector3 MoreMountains.TopDownEngine.PhysicsProjectile.InitialRotation = Vector3.zero

The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/Weapons/PhysicsProjectile.cs