📚
Deadly Dungeons
  • Initial page
  • Traps
    • Introduction
    • Trap Triggers
    • Raycast Triggers
    • Disabling Traps with Triggers
    • Trap
    • Trap Mechanism
      • Animator
      • Launcher
      • Particle (Trap Mechanism)
      • Physics
    • Effect Handlers
      • Audio Handler
      • Particle (Effect Handler)
      • Ray Handler
      • Custom Effect Handler
    • Damage System
      • Damage Source
      • IDamageable
      • Damage Result
    • Damageable Example
    • Utility
      • AutoConnect Joint
      • Texture Mover
Powered by GitBook
On this page

Was this helpful?

  1. Traps
  2. Trap Mechanism

Launcher

PreviousAnimatorNextParticle (Trap Mechanism)

Last updated 4 years ago

Was this helpful?

This component shoots a projectile using object pooling. In short, it only instantiates a number of projectiles then reuses the already instantiated. This is good for performance. ().

  • Play Mode: the projectile is spawned and launched Only once or continuously (Loop).

  • Cooldown: the time (in seconds) between two spawn events.

Launcher Settings

  • Force: the force that is applied to the projectile

  • Max Distance: projectile deactivates and returns to the pool after this distance even if it didn’t collide with anything.

  • Ammunition: you can limit how many times the launcher can shoot. 0 means unlimited ammo.

  • Stick on Collision: the projectile will stick to and move with the object it collides with. It disappears when the object pooler reuses it. Useful for arrows or darts.

Projectile Settings

  • Projectile: The script can handle multiple projectile prefabs. By default, it shoots the listed projectiles one by one, based on their order. Enable the Randomize option for random selection.

  • Pool Size: the script will instantiate only this amount of projectile from each prefab.

Trap Projectile

To create a projectile prefab to be used in the launcher, simply attach this script to a game object and save as a prefab in your Project folder.

This component moves the projectile. It’s inherited from a , so you can set the damage.

Damage Source
more information here