SanAndreasUnity/Assets/Scripts/Importing/Items/Definitions/VehicleDef.cs
2020-05-31 19:07:22 +02:00

81 lines
No EOL
1.9 KiB
C#

using System;
using System.Globalization;
namespace SanAndreasUnity.Importing.Items.Definitions
{
public enum VehicleType
{
Trailer,
Bmx,
Bike,
Train,
Boat,
Plane,
Heli,
Quad,
MTruck,
Car
}
[Section("cars")]
public class VehicleDef : Definition, IObjectDefinition
{
public readonly int Id;
int IObjectDefinition.Id
{
get { return Id; }
}
public readonly string ModelName;
public readonly string TextureDictionaryName;
public readonly VehicleType VehicleType;
public readonly string HandlingName;
public readonly string GameName;
public readonly string AnimsName;
public readonly string ClassName;
public readonly int Frequency;
public readonly int Flags;
public readonly int CompRules;
public readonly bool HasWheels;
public readonly int WheelId;
public readonly float WheelScaleFront;
public readonly float WheelScaleRear;
public readonly int UpgradeId;
public VehicleDef(string line) : base(line)
{
Id = GetInt(0);
ModelName = GetString(1);
TextureDictionaryName = GetString(2);
VehicleType = (VehicleType)Enum.Parse(typeof(VehicleType), GetString(3), true);
HandlingName = GetString(4);
GameName = GetString(5);
AnimsName = GetString(6);
ClassName = GetString(7);
Frequency = GetInt(8);
Flags = GetInt(9);
CompRules = GetInt(10, NumberStyles.HexNumber);
HasWheels = Parts >= 15;
if (HasWheels)
{
WheelId = GetInt(11);
WheelScaleFront = GetSingle(12);
WheelScaleRear = GetSingle(13);
UpgradeId = GetInt(14);
}
}
}
}