Пример #1
0
        public void AddVehiclePanel(VehicleBehaviour behaviour)
        {
            var panel = Instantiate(vehiclePanelPrefab, vehicleListPanel.transform);

            if (behaviour.Vehicle is Car)
            {
                panel.ShowCarUI();
            }
            else if (behaviour.Vehicle is Motorcycle)
            {
                panel.ShowMotoUI();
            }
            else if (behaviour.Vehicle is Truck)
            {
                panel.ShowTruckUI();
            }
            vehiclePanels.Add(panel);
            panel.VehicleBehaviour = behaviour;
            panel.OnDelete.AddListener(x => { GameManager.DeleteVehicle(x); DeleteVehiclePanel(x); });
        }
Пример #2
0
 public void DeleteVehicle(VehicleBehaviour behaviour)
 {
     vehicleBehaviours.Remove(behaviour);
     Destroy(behaviour.gameObject);
     UpdateVehiclePositions();
 }
Пример #3
0
 public void AddVehicleBehaviour(VehicleBehaviour behaviour)
 {
     vehicleBehaviours.Add(behaviour);
     behaviour.Place = vehicleBehaviours.Count;
     UpdateVehiclePositions();
 }