void changeObject() { currentType++; if (currentType == Vehicle.vehicleType.Base) { currentType = Vehicle.vehicleType.Tank; } currentVehicle = GetVehicleByType(currentType); Debug.Log("Changed object to id:" + currentType + ", name:" + currentVehicle.vehicleObject.name); }
Vehicle GetVehicleByType(Vehicle.vehicleType type) { foreach (Vehicle v in GameLogic.Instance.vehicleTypes) { if (type == v.type) { return(v); } } return(null); }
// Use this for initialization void Start() { aiMovementMode = moveMode.Command; agent.updatePosition = false; agent.updateRotation = false; vehicleType = controller.vehicle.type; switch (vehicleType) { case Vehicle.vehicleType.Tank: attackController = GetComponentInChildren <TankTurretControl>(); break; case Vehicle.vehicleType.Truck: break; case Vehicle.vehicleType.Heli: break; case Vehicle.vehicleType.Spy: break; case Vehicle.vehicleType.Base: break; default: attackController = GetComponentInChildren <WeaponControl>(); break; } Vehicle v = GetComponent <VehicleController>().vehicle; attackRange = v.attackRange; sightRange = v.sightRange; oldPos = transform.position; }
public Vehicle SummonVehicle(GameObject prefab, Vector3 position, Quaternion rotation, Vehicle.vehicleType type, Vehicle.vehicleSide side = Vehicle.vehicleSide.Player) { GameObject newVehicleObj = (GameObject)Instantiate(prefab, position, rotation); Vehicle vehicle = new Vehicle(newVehicleObj, type, side); newVehicleObj.GetComponent <VehicleController>().vehicle = vehicle; vehicles.Add(vehicle); Debug.Log("added " + vehicle.vehicleObject.name); return(vehicle); }
void Start() { currentType = Vehicle.vehicleType.Tank; currentVehicle = GetVehicleByType(currentType); }