private bool TruckInPosition(ConvoyTruck truck) { if(!truck) return false; float closeEnough = 3.0f; Vector3 truckPos = truck.transform.position; bool xInPos = truckPos.x > destination.x - closeEnough && truckPos.x < destination.x + closeEnough; bool zInPos = truckPos.z > destination.z - closeEnough && truckPos.z < destination.z + closeEnough; return xInPos && zInPos; }
private bool TruckInPosition(ConvoyTruck truck) { if (!truck) { return(false); } float closeEnough = 3.0f; Vector3 truckPos = truck.transform.position; bool xInPos = truckPos.x > destination.x - closeEnough && truckPos.x < destination.x + closeEnough; bool zInPos = truckPos.z > destination.z - closeEnough && truckPos.z < destination.z + closeEnough; return(xInPos && zInPos); }
public override bool PlayerMeetsConditions(Player player) { ConvoyTruck truck = player.GetComponentInChildren <ConvoyTruck>(); return(player && !player.IsDead() && TruckInPosition(truck)); }