示例#1
0
        public double DistanceToEuclid(Position2DViewModel other)
        {
            var x = other.Latitude - Latitude;
            var y = (other.Longitude - Longitude) * cosOfLatitude;

            return(deglen * Math.Sqrt(x * x + y * y));
        }
示例#2
0
 public WildPokemonViewModel(WildPokemon pokemon, Settings settings) : base(pokemon.PokemonData, settings)
 {
     EncounterId             = pokemon.EncounterId;
     LastModifiedTimestampMs = pokemon.LastModifiedTimestampMs;
     Position         = new Position2DViewModel(pokemon.Latitude, pokemon.Longitude);
     SpawnpointId     = pokemon.SpawnPointId;
     TimeTillHiddenMs = pokemon.TimeTillHiddenMs;
 }
示例#3
0
 public WildPokemonViewModel(PokemonData pokemon, FortData fort, Settings settings)
     : base(pokemon, settings)
 {
     EncounterId             = fort.LureInfo.EncounterId;
     LastModifiedTimestampMs = fort.LastModifiedTimestampMs;
     Position         = new Position2DViewModel(fort.Latitude, fort.Longitude);
     SpawnpointId     = fort.LureInfo.FortId;
     TimeTillHiddenMs = fort.LureInfo.LureExpiresTimestampMs;
 }
示例#4
0
        public double DistanceTo(Position2DViewModel other)
        {
            var lat2 = ToRadians(other.Latitude);
            var dLat = ToRadians(other.Latitude - Latitude);
            var dLng = ToRadians(other.Longitude - Longitude);
            var h    = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + cosOfLatitude * Math.Cos(lat2) * Math.Sin(dLng / 2) * Math.Sin(dLng / 2);
            var c    = 2 * Math.Atan2(Math.Sqrt(h), Math.Sqrt(1 - h));

            return(R * c);
        }
        public MapPokemonViewModel(MapPokemon pokemon, SessionViewModel session, Settings settings, PlayerViewModel player, MapViewModel map)
            : base(pokemon.PokemonId, pokemon.EncounterId, settings)
        {
            this.session = session;
            this.player  = player;
            this.map     = map;

            EncounterId           = pokemon.EncounterId;
            ExpirationTimestampMs = pokemon.ExpirationTimestampMs;
            SpawnPointId          = pokemon.SpawnPointId;
            Position = new Position2DViewModel(pokemon.Latitude, pokemon.Longitude);
        }
        public MapPokemonViewModel(FortData fort, SessionViewModel session, Settings settings, PlayerViewModel player, MapViewModel map)
            : base(fort.LureInfo.ActivePokemonId, fort.LureInfo.EncounterId, settings)
        {
            this.session = session;
            this.player  = player;
            this.map     = map;

            isPokemonFromLure = true;
            this.fort         = fort;
            var lureInfo = fort.LureInfo;

            EncounterId           = lureInfo.EncounterId;
            ExpirationTimestampMs = lureInfo.LureExpiresTimestampMs;
            SpawnPointId          = lureInfo.FortId;
            Position = new Position2DViewModel(fort.Latitude, fort.Longitude);
        }
示例#7
0
 public bool Equals(Position2DViewModel other)
 {
     return(other != null &&
            Latitude == other.Latitude &&
            Longitude == other.Longitude);
 }
示例#8
0
 public bool IsInRange(Position2DViewModel other, double range) => DistanceToEuclid(other) <= range && DistanceTo(other) <= range;
示例#9
0
 public FortViewModel(FortData fort, SessionViewModel session)
 {
     Position     = new Position2DViewModel(fort.Latitude, fort.Longitude);
     Id           = fort.Id;
     this.session = session;
 }
示例#10
0
 bool CanExecuteMove(Position2DViewModel param) => true;
示例#11
0
 Task ExecuteMove(Position2DViewModel param)
 => MoveToAsync(param.To3D(Position.Altitute));