private static bool checkInformationVehicle(Objective objective) { InformationVehicle vehicle = getInformationVehicle(objective.targetId); if (vehicle != null) { switch (objective.key) { case "distance": return(vehicle.distance >= objective.value); // TODO - More here - condition...? } } return(false); }
private static InformationVehicle getInformationVehicle(long targetId) { if (!cachedVehicles.ContainsKey(targetId)) { GameObject vehicle = GameObject.Find("Vehicle (id:" + targetId + ")"); if (vehicle != null) { InformationVehicle informationVehicle = vehicle.GetComponent <InformationVehicle> (); cachedVehicles.Add(targetId, informationVehicle); informationVehicle.getInformation(); } } if (cachedVehicles.ContainsKey(targetId)) { return(cachedVehicles [targetId]); } return(null); }