Beispiel #1
0
        private void update_following_unit()
        {
            Game_Unit unit     = Global.game_map.units[Following_Unit_Id];
            Vector2   real_loc = unit.update_player_following_movement();

            int dist = (int)Math.Max(Math.Abs(Real_Loc.X - real_loc.X), Math.Abs(Real_Loc.Y - real_loc.Y));

            bool moved = (int)Real_Loc.X != (int)real_loc.X ||
                         (int)Real_Loc.Y != (int)real_loc.Y;

            Real_Loc = real_loc;

            center(Real_Loc / UNIT_TILE_SIZE, true);
            if (moved)
            {
                Global.game_map.scroll_speed = dist;
            }

            if (unit.move_route_empty && (Loc == Real_Loc / UNIT_TILE_SIZE || !moved))
            {
                Following_Unit_Id = -1;
            }
        }