示例#1
0
        public Mobile(ActorInitializer init, MobileInfo info)
        {
            this.self = init.self;
            this.Info = info;

            toSubCell = fromSubCell = info.SharesCell ? SubCell.Center : SubCell.FullCell;
            if (init.Contains <SubCellInit>())
            {
                this.fromSubCell = this.toSubCell = init.Get <SubCellInit, SubCell>();
            }

            if (init.Contains <LocationInit>())
            {
                this.__fromCell = this.__toCell = init.Get <LocationInit, CPos>();
                SetVisualPosition(self, fromCell.CenterPosition + MobileInfo.SubCellOffsets[fromSubCell]);
            }

            this.Facing = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : info.InitialFacing;

            if (init.Contains <AltitudeInit>())
            {
                var z = init.Get <AltitudeInit, int>() * 1024 / Game.CellSize;
                SetVisualPosition(self, CenterPosition + new WVec(0, 0, z - CenterPosition.Z));
            }
        }
示例#2
0
        public Mobile(ActorInitializer init, MobileInfo info)
        {
            this.self = init.self;
            this.Info = info;

            toSubCell = fromSubCell = info.SharesCell ? SubCell.Center : SubCell.FullCell;
            if (init.Contains <SubCellInit>())
            {
                this.fromSubCell = this.toSubCell = init.Get <SubCellInit, SubCell>();
            }

            if (init.Contains <LocationInit>())
            {
                this.__fromCell = this.__toCell = init.Get <LocationInit, CPos>();
                SetVisualPosition(self, init.world.Map.CenterOfCell(fromCell) + MobileInfo.SubCellOffsets[fromSubCell]);
            }

            this.Facing = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : info.InitialFacing;

            // Sets the visual position to WPos accuracy
            // Use LocationInit if you want to insert the actor into the ActorMap!
            if (init.Contains <CenterPositionInit>())
            {
                SetVisualPosition(self, init.Get <CenterPositionInit, WPos>());
            }
        }
示例#3
0
 public PathSearch(World world, MobileInfo mobileInfo, Player owner)
 {
     this.world      = world;
     cellInfo        = InitCellInfo();
     this.mobileInfo = mobileInfo;
     this.owner      = owner;
     queue           = new PriorityQueue <PathDistance>();
 }
示例#4
0
        public static PathSearch Search(World world, MobileInfo mi, Actor self, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, self)
            {
                CheckForBlocked = checkForBlocked
            };

            return(search);
        }
示例#5
0
		public static PathSearch Search(World world, MobileInfo mi, Actor self, bool checkForBlocked)
		{
			var search = new PathSearch(world, mi, self)
			{
				CheckForBlocked = checkForBlocked
			};

			return search;
		}
示例#6
0
 public PathSearch(World world, MobileInfo mobileInfo, Actor self)
 {
     this.world      = world;
     cellInfo        = InitCellInfo();
     this.mobileInfo = mobileInfo;
     this.self       = self;
     customCost      = null;
     queue           = new PriorityQueue <PathDistance>();
 }
示例#7
0
        public static PathSearch Search(World world, MobileInfo mi, Player owner, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, owner)
            {
                checkForBlocked = checkForBlocked
            };

            return(search);
        }
示例#8
0
		public static PathSearch FromPoint(World world, MobileInfo mi, Actor self, CPos from, CPos target, bool checkForBlocked)
		{
			var search = new PathSearch(world, mi, self)
			{
				Heuristic = DefaultEstimator(target),
				CheckForBlocked = checkForBlocked
			};

			search.AddInitialCell(from);
			return search;
		}
示例#9
0
        public static PathSearch FromPoint(World world, MobileInfo mi, Actor self, CPos from, CPos target, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, self)
            {
                Heuristic       = DefaultEstimator(target),
                CheckForBlocked = checkForBlocked
            };

            search.AddInitialCell(from);
            return(search);
        }
示例#10
0
        public static PathSearch FromPoint(World world, MobileInfo mi, Player owner, int2 from, int2 target, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, owner)
            {
                heuristic       = DefaultEstimator(target),
                checkForBlocked = checkForBlocked
            };

            search.AddInitialCell(from);
            return(search);
        }
示例#11
0
 public PathSearch(World world, MobileInfo mobileInfo, Actor self)
 {
     this.self       = self;
     CellInfo        = InitCellInfo();
     this.mobileInfo = mobileInfo;
     this.self       = self;
     customCost      = null;
     Queue           = new PriorityQueue <PathDistance>();
     Considered      = new HashSet <CPos>();
     MaxCost         = 0;
     nextDirections  = CVec.directions.Select(d => new Pair <CVec, int>(d, 0)).ToArray();
 }
示例#12
0
		public PathSearch(World world, MobileInfo mobileInfo, Actor self)
		{
			this.self = self;
			CellInfo = InitCellInfo();
			this.mobileInfo = mobileInfo;
			this.self = self;
			customCost = null;
			Queue = new PriorityQueue<PathDistance>();
			Considered = new HashSet<CPos>();
			MaxCost = 0;
			nextDirections = CVec.directions.Select(d => new Pair<CVec, int>(d, 0)).ToArray();
		}
示例#13
0
		public static PathSearch FromPoints(World world, MobileInfo mi, Actor self, IEnumerable<CPos> froms, CPos target, bool checkForBlocked)
		{
			var search = new PathSearch(world, mi, self)
			{
				Heuristic = DefaultEstimator(target),
				CheckForBlocked = checkForBlocked
			};

			foreach (var sl in froms)
				search.AddInitialCell(sl);

			return search;
		}
示例#14
0
        public static PathSearch FromPoints(World world, MobileInfo mi, Player owner, IEnumerable <int2> froms, int2 target, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, owner)
            {
                heuristic       = DefaultEstimator(target),
                checkForBlocked = checkForBlocked
            };

            foreach (var sl in froms)
            {
                search.AddInitialCell(sl);
            }

            return(search);
        }
示例#15
0
        public static PathSearch FromPoints(World world, MobileInfo mi, Actor self, IEnumerable <CPos> froms, CPos target, bool checkForBlocked)
        {
            var search = new PathSearch(world, mi, self)
            {
                Heuristic       = DefaultEstimator(target),
                CheckForBlocked = checkForBlocked
            };

            foreach (var sl in froms)
            {
                search.AddInitialCell(sl);
            }

            return(search);
        }
示例#16
0
        public Mobile(ActorInitializer init, MobileInfo info)
        {
            this.self = init.self;
            this.Info = info;

            toSubCell = fromSubCell = info.SharesCell ? SubCell.Center : SubCell.FullCell;
            if (init.Contains <SubCellInit>())
            {
                this.fromSubCell = this.toSubCell = init.Get <SubCellInit, SubCell>();
            }

            if (init.Contains <LocationInit>())
            {
                this.__fromCell = this.__toCell = init.Get <LocationInit, CPos>();
                this.PxPosition = Util.CenterOfCell(fromCell) + info.SubCellOffsets[fromSubCell];
            }

            this.Facing   = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : info.InitialFacing;
            this.Altitude = init.Contains <AltitudeInit>() ? init.Get <AltitudeInit, int>() : 0;
        }
示例#17
0
 public MoveOrderTargeter(Actor self, MobileInfo unitType)
 {
     this.unitType   = unitType;
     this.rejectMove = !self.AcceptsOrder("Move");
 }
示例#18
0
 public MoveOrderTargeter(MobileInfo unitType)
 {
     this.unitType = unitType;
 }