public Entity FromVehicleInstance(ScenarioTag.VehicleInstance item) { var entity = ItemFactory.CreateFromVehicleInstance(this.Map, this.Map.Scenario, item); item.GameObject = entity; return(entity); }
public static Vehicle CreateFromVehicleInstance(H2vMap map, ScenarioTag scenario, ScenarioTag.VehicleInstance instance) { var item = new Vehicle(); item.FriendlyName = "Vehicle_" + instance.Index; var def = scenario.VehicleDefinitions[instance.Index]; if (map.TryGetTag(def.Vehicle, out var vehi) == false) { throw new Exception("No tag found for vehi reference"); } var xform = new TransformComponent(item, instance.Position, QuaternionExtensions.FromH2vOrientation(instance.Orientation)); PopulateVehicle(item, map, xform, vehi); return(item); }