public void BuildSelf(NodeAddedEvent e, SelfTankNode tank, [Context, JoinByUser] WeaponNode weapon) { weapon.Entity.AddComponent <CooldownTimerComponent>(); weapon.Entity.AddComponent <StreamWeaponControllerComponent>(); weapon.Entity.AddComponent <ConicTargetingComponent>(); weapon.Entity.AddComponent(new WeaponHitComponent(false, false)); weapon.Entity.AddComponent <DirectionEvaluatorComponent>(); weapon.Entity.AddComponent <DistanceAndAngleTargetEvaluatorComponent>(); TargetCollectorComponent component = new TargetCollectorComponent(new TargetCollector(tank.Entity), new TargetValidator(tank.Entity)); weapon.Entity.AddComponent(component); }
public void BuildSelf(Entity weapon, Entity tank) { weapon.AddComponent <CooldownTimerComponent>(); weapon.AddComponent <DiscreteWeaponControllerComponent>(); weapon.AddComponent <VerticalSectorsTargetingComponent>(); weapon.AddComponent <DirectionEvaluatorComponent>(); weapon.AddComponent <WeaponShotComponent>(); weapon.AddComponent(new WeaponHitComponent(true, false)); weapon.AddComponent <DistanceAndAngleTargetEvaluatorComponent>(); TargetCollectorComponent component = new TargetCollectorComponent(new TargetCollector(tank), new TargetValidator(tank)); weapon.AddComponent(component); }
private Vector3 GetTargetPoint(Vector3 start, Vector3 dir, float length, TargetCollectorComponent targetCollector) { DirectionData data = targetCollector.Collect(start, dir, length, LayerMasks.VISUAL_TARGETING); return(!data.HasAnyHit() ? (start + (dir * length)) : data.FirstAnyHitPosition()); }
public void Build(NodeAddedEvent evt, TankNode selfTank, [Context, JoinByUser] WeaponNode weaponNode) { TargetCollectorComponent component = new TargetCollectorComponent(new TargetCollector(selfTank.Entity), new TargetValidator(selfTank.Entity)); weaponNode.Entity.AddComponent(component); }