using System;
using System.Data;
using Woodpecker.Game.Rooms.Instances;
using Woodpecker.Game.Rooms.Pathfinding;
namespace Woodpecker.Game.Rooms
{
public class roomModel
{
#region Fields
///
/// The name of this room model.
///
public string typeName;
///
/// A value of the roomModelUserType enum representing the type of this model. (public space, user flat etc)
///
internal roomModelUserType userType;
///
/// The X position of the door of this room model.
///
public byte doorX;
///
/// The Y position of the door of this room model.
///
public byte doorY;
///
/// The height of the door of this room model as a float.
///
public float doorZ;
///
/// The heightmap of this room model as a string.
///
public string sHeightmap;
private string[] mHeightMapAxes;
public string[] heightMapAxes
{
get { return (string[])mHeightMapAxes.Clone(); }
}
#endregion
#region Methods
public static roomModel Parse(DataRow dRow)
{
roomModel retModel = new roomModel();
try
{
retModel.typeName = (string)dRow["modeltype"];
retModel.userType = (roomModelUserType)int.Parse(dRow["usertype"].ToString());
retModel.doorX = (byte)int.Parse(dRow["door_x"].ToString());
retModel.doorY = (byte)int.Parse(dRow["door_y"].ToString());
retModel.doorZ = (float)dRow["door_z"];
retModel.sHeightmap = dRow["heightmap"].ToString().ToLower();
retModel.mHeightMapAxes = retModel.sHeightmap.Split('|');
}
catch { retModel = null; }
return retModel;
}
#endregion
}
///
/// Represents the user type of a room model.
///
internal enum roomModelUserType
{
///
/// This model can be used with public spaces only.
///
PublicSpaceModel = 0,
///
/// This model is a generic user flat.
///
UserFlatModel = 1,
///
/// This model is a special user flat which requires fuse_use_special_room_layouts to create an instance of.
///
UserFlatSpecialModel = 2
}
}