Ejemplo n.º 1
0
        static void Main()
        {
            Point3D myPoint = new Point3D(1, 2, 3);

            Console.WriteLine("The ToString() overload: {0}", myPoint);
            Console.WriteLine();

            Console.WriteLine("The static point 0: {0}", Point3D.CentrePoint);
            Console.WriteLine();

            Point3D myOtherPoint   = new Point3D(3, 2, 1);
            double  pointsDistance = CalculateDistance.Distance(myPoint, myOtherPoint);

            Console.WriteLine("Calculated distance: {0}", pointsDistance);
            Console.WriteLine();

            Path route = new Path();

            route.AddPoint(Point3D.CentrePoint);
            route.AddPoint(myPoint);
            route.AddPoint(myOtherPoint);
            route.AddPoint(new Point3D(1.1, 2.2, 3.82743658793465));
            Console.WriteLine("One of the points in the path: {0}", route.PointsPath[1]);
            Console.WriteLine();

            PathStorage.SavePath(route, "../../test.txt");

            Path loadedRoute = PathStorage.LoadPath("../../test.txt");

            Console.WriteLine("Print path loaded from file");
            foreach (var point in loadedRoute.PointsPath)
            {
                Console.WriteLine(point);
            }
        }
Ejemplo n.º 2
0
    //private ShipManager shipManager;

    private void Start()
    {
        calculateDistance = GetComponent <CalculateDistance>();
        currentCapacity   = startingCapacity;
        currentFuel       = currentCapacity;
        //shipManager = GetComponent<ShipManager>();
        upgradeManager = GetComponent <UpgradeManager>();
    }
Ejemplo n.º 3
0
    private void Start()
    {
        calculateDistance = FindObjectOfType <CalculateDistance>();

        timers = new float[spawnableEnemies.Length];
        for (int i = 0; i < timers.Length; i++)
        {
            timers[i] = 0.0f;
        }
    }
Ejemplo n.º 4
0
 private void Awake()
 {
     if (calculateDistance == null)
     {
         calculateDistance = FindObjectOfType <CalculateDistance>();
     }
     scanRubbish     = GetComponent <ScanRubbish>();
     fillerImage     = GetComponent <Image>();
     playerDataSaver = GetComponent <PlayerDataSaver>();
 }
Ejemplo n.º 5
0
 private void OnEnable()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Ejemplo n.º 6
0
    // Start is called before the first frame update
    void Start()
    {
        calculateDistance = FindObjectOfType <CalculateDistance>();

        Material skyboxMatCopy = new Material(RenderSettings.skybox);

        RenderSettings.skybox = skyboxMatCopy;

        RenderSettings.skybox.SetColor("_colorTop", skyboxThresholds[0].topColor);
        RenderSettings.skybox.SetColor("_colorBottom", skyboxThresholds[0].bottomColor);
        RenderSettings.skybox.SetFloat("_gradientHeight", skyboxThresholds[0].height);
    }
Ejemplo n.º 7
0
 // Returns if the event is within an area
 private static bool EventDistance(double lat, double lon, double[] cords)
 {
     return(CalculateDistance.Calculate(new Location
     {
         Latitude = lat,
         Longitude = lon
     }, new Location
     {
         Latitude = cords[0],
         Longitude = cords[1]
     }) < cords[2]);
 }
Ejemplo n.º 8
0
        internal async Task <IEnumerable <RestaurantSummaryEntity> > Search(FilterDefinition <RestaurantEntity> searchFilter,
                                                                            int start, int limit, Point usersLocation)
        {
            var Collection   = context.Database.GetCollection <RestaurantEntity>(MongoCollectionNames.RestaurantsCollectionName);
            var searchResult = await Collection.Find(searchFilter).Skip(start).Limit(limit).ToListAsync();

            var list = new List <RestaurantSummaryEntity>();

            foreach (var item in searchResult)
            {
                item.IsOpenNow = OpenOrCloseDetector.Detect(item);
                item.Distance  = CalculateDistance.distance(usersLocation, item.GeoPoint);
                var result = new RestaurantSummaryEntity(item);
                list.Add(result);
            }
            return(list);
        }
Ejemplo n.º 9
0
    private void Start()
    {
        calculateDistance = FindObjectOfType <CalculateDistance>();

        startingYPos = transform.position.y;
    }
Ejemplo n.º 10
0
        public void TestCalculateDistanceMethodWithExpectation()
        {
            CalculateDistance c = new CalculateDistance();

            Assert.IsTrue(Math.Abs(c.Calculate(52.986375, -6.043701, 53.3381985, -6.2592576) - 41.62) < 0.5);
        }
Ejemplo n.º 11
0
 public static  double CalcDiagonalYZ()
 {
     double distance = CalculateDistance.CalcDistance2D(0, 0, Height, Depth);
     return distance;
 }
Ejemplo n.º 12
0
 public static double CalcDiagonalXZ()
 {
     double distance = CalculateDistance.CalcDistance2D(0, 0, Width, Depth);
     return distance;
 }
Ejemplo n.º 13
0
 public static double CalcDiagonalXY()
 {
     double distance = CalculateDistance.CalcDistance2D(0, 0, Width, Height);
     return distance;
 }
 private void Start()
 {
     calculateDistance = FindObjectOfType <CalculateDistance>();
     ps = GetComponent <ParticleSystem>();
     em = ps.emission;
 }
Ejemplo n.º 15
0

        
Ejemplo n.º 16
0
 public void Create(T[] newItems, CalculateDistance <T> distanceCalculator)
 {
     this.items             = newItems;
     this.calculateDistance = distanceCalculator;
     this.root = this.BuildFromPoints(0, newItems.Length);
 }
Ejemplo n.º 17
0
        public void TestCalculateDistanceMethodWithSameTwoLocations()
        {
            CalculateDistance c = new CalculateDistance();

            Assert.IsTrue(c.Calculate(53.3381985, -6.2592576, 53.3381985, -6.2592576) == 0);
        }