public void ShootDroneWeapon(UpdateEvent e, SelfDroneWithTargetNode drone, [JoinByUnit] ShootingDroneWeapon droneWeapon) { if (droneWeapon.cooldownTimer.CooldownTimerSec <= 0f) { base.ScheduleEvent <ShotPrepareEvent>(droneWeapon); } }
public void Targeting(UpdateEvent e, SelfDroneWithTargetNode drone) { Entity target = drone.unitTarget.Target; if (!(target.Alive && target.HasComponent <TankActiveStateComponent>())) { drone.Entity.RemoveComponent <UnitTargetComponent>(); } }
public void ControllDroneWeapon(UpdateEvent e, SelfDroneWithTargetNode drone, [JoinByUnit] SelfDroneWeapon droneWeapon) { if ((Time.timeSinceLevelLoad - droneWeapon.droneWeapon.lastControlTime) >= WEAPON_CONTROL_PERIOD) { droneWeapon.droneWeapon.lastControlTime = Time.timeSinceLevelLoad; if (this.IsTargetVisable(droneWeapon)) { this.StartShooting(droneWeapon.Entity); drone.droneAnimator.StartShoot(); droneWeapon.droneWeapon.lastTimeTargetSeen = Time.time; } else { this.StopShooting(droneWeapon.Entity); drone.droneAnimator.StartIdle(); drone.Entity.RemoveComponentIfPresent <UnitTargetComponent>(); } } }
public void ControllDroneWeapon(NodeRemoveEvent e, SelfDroneWithTargetNode drone, [JoinByUnit] SelfDroneWeapon droneWeapon) { this.StopShooting(droneWeapon.Entity); }