mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
Add new screens for game management, team management, and cache handling; implement caching logic and session management
This commit is contained in:
1 parent
8686f0e1ff
commit
17ed120ce8
70 files changed
+2172
-3892
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import * as geolib from 'geolib';
|
||||
|
||||
const isWithinRadius = (playerCoords, cacheCoords, radius) => {
|
||||
const distance = geolib.getDistance(playerCoords, cacheCoords);
|
||||
return distance <= radius;
|
||||
};
|
||||
|
||||
const isLookingAtCache = (playerHeading, playerCoords, cacheCoords, tolerance = 20) => {
|
||||
if (playerHeading === null || playerHeading === undefined) {
|
||||
return false;
|
||||
}
|
||||
const bearingToCache = geolib.getRhumbLineBearing(playerCoords, cacheCoords);
|
||||
const diff = Math.abs(bearingToCache - playerHeading);
|
||||
return diff <= tolerance || diff >= 360 - tolerance;
|
||||
};
|
||||
|
||||
export { isWithinRadius, isLookingAtCache };
|
||||
|
||||
Reference in new issue
Block a user