예제 #1
0
        public Husk(ActorInitializer init, HuskInfo info)
        {
            this.info = info;
            this.self = init.self;

            TopLeft        = init.Get <LocationInit, CPos>();
            CenterPosition = init.Contains <CenterPositionInit>() ? init.Get <CenterPositionInit, WPos>() : init.world.Map.CenterOfCell(TopLeft);
            Facing         = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : 128;

            dragSpeed     = init.Contains <HuskSpeedInit>() ? init.Get <HuskSpeedInit, int>() : 0;
            finalPosition = init.world.Map.CenterOfCell(TopLeft);
        }
예제 #2
0
        public Husk(ActorInitializer init, HuskInfo info)
        {
            this.info = info;
            this.self = init.self;

            TopLeft        = init.Get <LocationInit, CPos>();
            CenterPosition = init.Contains <CenterPositionInit>() ? init.Get <CenterPositionInit, WPos>() : TopLeft.CenterPosition;
            Facing         = init.Contains <FacingInit>() ? init.Get <FacingInit, int>() : 128;

            var speed    = init.Contains <HuskSpeedInit>() ? init.Get <HuskSpeedInit, int>() : 0;
            var distance = (TopLeft.CenterPosition - CenterPosition).Length;

            if (speed > 0 && distance > 0)
            {
                self.QueueActivity(new Drag(CenterPosition, TopLeft.CenterPosition, distance / speed));
            }
        }