Exemple #1
0
        public static int DistanceBetweenEntities(Entity a, Entity b)
        {
            var aPos = a.TryGetPosition();
            var bPos = b.TryGetPosition();

            if (aPos.Z != bPos.Z)
            {
                return(Int16.MaxValue);
            }

            return(FloorState.DistanceBetweenPositions(aPos.X, aPos.Y, bPos.X, bPos.Y));
        }
Exemple #2
0
 private static bool InScanRangeOfPlayer(Entity player, Entity aiEntity, Cell possiblePosition)
 {
     if (player != null)
     {
         var scanRange = aiEntity.TryGetAttribute(EntityAttributeType.SCAN_REQUIRED_RADIUS).Value;
         var playerPos = player.TryGetPosition();
         var dist      = FloorState.DistanceBetweenPositions(playerPos.X, playerPos.Y, possiblePosition.X, possiblePosition.Y);
         return(dist <= scanRange);
     }
     else
     {
         return(false);
     }
 }