Пример #1
0
 public void InitiateCrashEvent(WorldObject worldObject)
 {
     vehicle.CompVehicleLauncher.inFlight = false;
     Tile = WorldHelper.GetNearestTile(DrawPos);
     ResetPosition(Find.WorldGrid.GetTileCenter(Tile));
     flightPath.ResetPath();
     AirDefensePositionTracker.DeregisterAerialVehicle(this);
     (VehicleIncidentDefOf.BlackHawkDown.Worker as IncidentWorker_ShuttleDowned).TryExecuteEvent(this, worldObject);
 }
Пример #2
0
        public void OrderFlyToTiles(List <FlightNode> flightPath, Vector3 origin, AerialVehicleArrivalAction arrivalAction = null)
        {
            if (flightPath.NullOrEmpty() || flightPath.Any(node => node.tile < 0))
            {
                return;
            }
            if (arrivalAction != null)
            {
                this.arrivalAction = arrivalAction;
            }
            this.flightPath.NewPath(flightPath);
            InitializeNextFlight(origin);
            var flyoverDefenses = AirDefensePositionTracker.CheckNearbyObjects(this, speedPctPerTick)?.ToHashSet() ?? new HashSet <AirDefense>();

            AirDefensePositionTracker.RegisterAerialVehicle(this, flyoverDefenses);
        }
Пример #3
0
 public virtual void MoveForward()
 {
     transition += speedPctPerTick;
     if (transition >= 1)
     {
         if (flightPath.Path.Count > 1)
         {
             Vector3 newPos    = DrawPos;
             int     ticksLeft = Mathf.RoundToInt(1 / speedPctPerTick);
             flightPath.NodeReached(ticksLeft > TicksTillLandingElevation && !recon);
             if (Spawned)
             {
                 InitializeNextFlight(newPos);
             }
         }
         else
         {
             if (Elevation <= vehicle.CompVehicleLauncher.LandingAltitude)
             {
                 Messages.Message("VehicleAerialArrived".Translate(vehicle.LabelShort), MessageTypeDefOf.NeutralEvent);
                 Tile = flightPath.First.tile;
                 if (arrivalAction is AerialVehicleArrivalAction action)
                 {
                     action.Arrived(flightPath.First.tile);
                     if (action.DestroyOnArrival)
                     {
                         Destroy();
                     }
                 }
                 vehicle.CompVehicleLauncher.inFlight = false;
                 AirDefensePositionTracker.DeregisterAerialVehicle(this);
             }
             else if (flightPath.Path.Count <= 1 && vehicle.CompVehicleLauncher.Props.circleToLand)
             {
                 Vector3 newPos = DrawPos;
                 SetCircle(flightPath.First.tile);
                 InitializeNextFlight(newPos);
             }
         }
     }
 }