Projectile2D
This component represents automatically moving projectile for 2D games. This object inflicts damage to Hittable
objects of all opposite teams in certain radius after entering into target collider or after certain amount of time.
Projectile can be auto guided to the target and it can chase it. Projectile class is inherited from IPoolableObject, so it can be got from PoolSystem and it automatically returns to pool after explosion.
Parameters in inspector
Velocity – velocity of projectile movement (units per second). 10 by default.
Guiding – is this projectile guided to the target?
Guiding Force – how strong it is guided to the target? 0 = isn't guided, 1 = maximum guidance
Guiding Angle – width of guidance cone, if target is out of this cone, guiding will be stopped
Guiding Max Dist – max distance to target when guiding works
Lifetime – how much time projectile flies before automatical explosion
Damage Min – min damage to hittables
Damage Max – max damage to hittables
Explosion Radius – radius of explosion (1 unit by default)
Explosion Effect – poolable explosion particle effect.
Launch Sound - sound effect which will be played during projectile launch.
Hit Sound - sound effect which will be played during collisions.
Available methods
This method launches projectile from certain owner to the certain target. If owner is not set, this projectile will be neutral (TeamType.None) and will be able to inflict damage both to player team and enemies team.
Example:
This method launches projectile from certain owner to the certain direction. If owner is not set, this projectile will be neutral (TeamType.None) and will be able to inflict damage both to player team and enemies team.
Last updated