Ejemplo n.º 1
0
        public void TryLaunch(int destinationTile, AerialVehicleArrivalAction arrivalAction, bool recon = false)
        {
            if (!Vehicle.Spawned)
            {
                Log.Error("Tried to launch " + Vehicle + ", but it's unspawned.");
                return;
            }
            List <FlightNode> flightPath = LaunchTargeter.FlightPath;

            if (flightPath.LastOrDefault().tile != destinationTile)
            {
                flightPath.Add(new FlightNode(destinationTile, null));
            }
            Vehicle.CompVehicleLauncher.inFlight = true;
            VehicleSkyfaller_Leaving vehicleLeaving = (VehicleSkyfaller_Leaving)ThingMaker.MakeThing(Props.skyfallerLeaving);

            vehicleLeaving.arrivalAction = arrivalAction;
            vehicleLeaving.vehicle       = Vehicle;
            vehicleLeaving.flightPath    = new List <FlightNode>(flightPath);
            vehicleLeaving.orderRecon    = recon;
            GenSpawn.Spawn(vehicleLeaving, Vehicle.Position, Vehicle.Map, Vehicle.Rotation, WipeMode.Vanish);

            if (Vehicle.Spawned)
            {
                Vehicle.DeSpawn(DestroyMode.Vanish);
            }
            Find.WorldPawns.PassToWorld(Vehicle);

            CameraJumper.TryHideWorld();
        }