public void AddWheel(TrainWheel wheel, WheelPosition position) { Wheels[position] = wheel; wheel.transform.SetParent(transform); wheel.Wagon = this; UpdatePosition(false); }
public static TrainWheel GenerateTrainWheel() { GameObject wheelObject = GameObject.CreatePrimitive(PrimitiveType.Cylinder); wheelObject.transform.rotation = Quaternion.Euler(90f, 90f, 0f); wheelObject.transform.localScale = new Vector3(0.8f, 0.2f, Wagon.WheelHeight); TrainWheel wheel = wheelObject.AddComponent <TrainWheel>(); wheel.Init(null); return(wheel); }