Skip to main content

ItemShooter

A class in Root.Township, the global namespace.

Debug component that fires the pickup in a dock through a Shooter, once or on a timer. Clients ask the server to shoot.

Constructors​

MemberWhat it is
ItemShooter()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

12 private and internal fields
MemberWhat it is
private AltaCoroutine coroutineThe running AutoShoot coroutine.
private float intervalSeconds between auto shots.
private bool isAutoshootingWhether auto shooting is on.
private PickupDock itemDockDock holding the pickup to fire.
private static Logger loggerLogger for this component.
private float maxVelocityShot speed passed to the shooter.
private Pickup pickupParent pickup that shot items ignore.
private bool shootEditor button field: shoots once.
private Shooter shooterThe Shooter that launches the item.
private Vector3 shootingDirectionLocal direction to shoot in.
private MethodSync syncShootSync message clients use to ask the server to shoot.
private bool toggleAutoshootEditor button field: toggles auto shoot.

Methods​

MemberWhat it is
override void Initialize()Sets up the shoot sync message.
void ShootOne()Fires the docked pickup along shootingDirection at maxVelocity. A client sends a request to the server instead.
8 private and internal methods
MemberWhat it is
private IEnumerator AutoShoot() (iterator)Coroutine that shoots once every interval seconds.
private void Awake()Finds the parent pickup and, if there is one, stops shot items from hitting it.
private void IgnoreArrowCollisions(Shooter arg1, Pickup arg2)Called before each shot. Makes the shot item ignore the parent pickup's colliders for a while.
private void OnValidate()Editor buttons: shoots once or toggles auto shoot.
private void StartAutoshoot()Starts the AutoShoot coroutine.
private void StopAutoshoot()Stops the AutoShoot coroutine.
private void SyncShoot(IPlayer player, Stream stream)Server: shoots when it gets the request. It does not check who sent it.
private void ToggleAutoShoot()Turns auto shooting on or off.