Exemple #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Reserve.Reserve(TargetIndex.A, 10));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch));

            Toil toil = new Toil();

            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = 50;
            toil.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(toil);

            yield return(new Toil
            {
                initAction = delegate
                {
                    ShipBase ship = (ShipBase)TargetA.Thing;
                    Action action = delegate
                    {
                        ship.TryAcceptThing(pawn, true);
                    };

                    ship.compShip.Notify_PawnEntered(this.pawn);

                    action();
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
Exemple #2
0
        public static Toil EnterShip(Pawn pawn, ShipBase ship)
        {
            Toil gotoShip = new Toil
            {
                initAction = delegate
                {
                    if (pawn.carryTracker.CarriedThing != null)
                    {
                        ship.TryAcceptThing(pawn.carryTracker.CarriedThing);
                    }
                    ship.TryAcceptThing(pawn, true);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            return(gotoShip);
        }
        public static Toil EnterShip(Pawn pawn, ShipBase ship)
        {
            Toil gotoShip = new Toil
            {
                initAction = delegate
                {
                    ship.TryAcceptThing(pawn, true);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            return(gotoShip);
        }
Exemple #4
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //yield return Toils_Reserve.Reserve(TargetIndex.A, 10, 1);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch));

            Toil toil = new Toil();

            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = 50;
            toil.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(toil);

            yield return(new Toil
            {
                initAction = delegate
                {
                    ShipBase ship = (ShipBase)TargetA.Thing;
                    Action action = delegate
                    {
                        if (pawn.carryTracker.CarriedThing != null)
                        {
                            ship.TryAcceptThing(pawn.carryTracker.CarriedThing);
                        }
                        if (ship.TryAcceptThing(pawn, true))
                        {
                            pawn.ClearMind();
                        }
                    };

                    action();
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }