public static Vehicle Create(VehicleSpawner spawner) { var inst = new GameObject().AddComponent <Vehicle>(); VehicleDef def; if (spawner.Info.CarId == -1) { def = GetRandomDef(); } else { def = Item.GetDefinition <VehicleDef>(spawner.Info.CarId); } inst.Initialize(def, spawner.Info.Colors); inst.transform.position = spawner.transform.position - Vector3.up * inst.AverageWheelHeight; inst.transform.localRotation = spawner.transform.rotation; if (Networking.Server.Instance != null) { Networking.Server.Instance.GlobalGroup.Add(inst); } return(inst); }
public static Vehicle Create(VehicleSpawner spawner) { var inst = new GameObject().AddComponent<Vehicle>(); VehicleDef def; if (spawner.Info.CarId == -1) { def = GetRandomDef(); } else { def = Item.GetDefinition<VehicleDef>(spawner.Info.CarId); } inst.Initialize(def, spawner.Info.Colors); inst.transform.position = spawner.transform.position - Vector3.up * inst.AverageWheelHeight; inst.transform.localRotation = spawner.transform.rotation; Networking.Server.Instance.GlobalGroup.Add(inst); return inst; }
public static Vehicle Create(VehicleSpawner spawner) { return(Create(spawner.Info.CarId, spawner.Info.Colors, spawner.transform.position, spawner.transform.rotation)); }