Example #1
0
        private void CreateWalls()
        {
            ObstacleModel obstacle1 = new ObstacleModel(100, 100, new Point(200, 100));
            ObstacleModel obstacle2 = new ObstacleModel(100, 100, new Point(200, 300));

            Obstacles.Add(obstacle1);
            Obstacles.Add(obstacle2);
        }
Example #2
0
        private void LoadObstacles()
        {
            var obstacles = App.ObstacleRepository.GetAll();

            uxObstacleList.ItemsSource = obstacles.Select(t => ObstacleModel.ToModel(t)).ToList();
            if (obstacles.Count > 0)
            {
                uxContextFileDeleteAll.IsEnabled = true;
            }
        }
        public void newObstacle(object sender, EventArgs e)
        {
            ObstacleModel om = new ObstacleModel(contextMenuLocation, 30);

            lock (obstacles)
            {
                obstacles.Add(om);
            }
            dragables.Add(om);
        }
Example #4
0
    void OnBatchRecieved(object bm)
    {
        BatchModel batchModel = (BatchModel)bm;

        int   resource;
        float spawnChance;

        if (tensionsEnabled)
        {
            resource    = 4;
            spawnChance = 100;
        }
        else
        {
            // Get the amount of resource points available for spawning obstacles in this batch
            resource = batchModel.GetTotalObstacleResources();

            // Get a random number for spawnChance
            spawnChance = Random.Range(0, 100f);
        }

        // Retrieve sub list of obstacles we can spawn given the spawnChance
        List <ObstacleModel> obstacles = batchModel.GetObstaclesWithSpawnChance(spawnChance);

        if (obstacles.Count != 0)
        {
            for (int i = 0; i < obstacles.Count; i++)
            {
                if (resource <= 0)
                {
                    break;
                }

                ObstacleModel obstacle = obstacles[Random.Range(0, obstacles.Count)];

                // if there is room given the laneWeight and if the obstacle is available
                if (resource - obstacle.laneWeight >= 0 && obstacle.IsAvailable())
                {
                    // try to place obstacle in a random slot in the batch
                    bool succesfullyPlaced = batchModel.PlaceGameItemInSpawnPoint(obstacle);
                    if (succesfullyPlaced)
                    {
                        resource -= obstacle.laneWeight;
                        obstacle.SetAvailable(false);
                    }
                }
            }
        }

        // dispatch ready
        EventManager.TriggerEvent(SpawnSystemEvents.OBSTACLES_ASSIGNED, batchModel);
    }
Example #5
0
 void OnBirdPoolingFinished()
 {
     //Set the obstacle parameter after instantiate it.
     foreach (GameObject go in birdPool.objs)
     {
         ObstacleModel obs = go.GetComponent <ObstacleModel>();
         obs.pool     = birdPool;
         obs.endPoint = endPoint;
         obs.speed    = obstacleSpd;
     }
     Debug.Log("Finish the bird pooling");
     tutorial++;
 }
Example #6
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (Obstacle != null)
     {
         uxSubmit.Content        = "Update";
         uxLatDD.Visibility      = Visibility.Visible;
         uxLatDDLabel.Visibility = Visibility.Visible;
         uxLonDD.Visibility      = Visibility.Visible;
         uxLonDDLabel.Visibility = Visibility.Visible;
         uxGrid.DataContext      = Obstacle;
     }
     else
     {
         Obstacle       = new ObstacleModel();
         Obstacle.ObsId = Obstacle.ObsId;
     }
 }
Example #7
0
        private void uxSubmit_Click(object sender, RoutedEventArgs e)
        {
            Obstacle                 = new ObstacleModel();
            Obstacle.ObsStudy        = uxObsStudy.Text;
            Obstacle.ObsType         = uxObsType.Text;
            Obstacle.ObsLatitudeDms  = double.Parse(uxObsLatDms.Text);
            Obstacle.ObsLongitudeDms = double.Parse(uxObsLatDms.Text);
            //Obstacle.ObstLatitudeDd = double.Parse(uxLatDD.Text);
            //Obstacle.ObsLongitudeDd = double.Parse(uxLonDD.Text);
            Obstacle.ObsLongitudeHemisphere = uxLonHem.Text;
            Obstacle.ObsLatitudeHemisphere  = uxLatHem.Text;
            Obstacle.ObsAglHeight           = int.Parse(uxAglHeight.Text);
            Obstacle.ObsMslHeight           = int.Parse(uxMslHeight.Text);
            Obstacle.ObsIcao = uxIcao.Text;


            // This is the return value of ShowDialog( ) below
            DialogResult = true;
            Close();
        }
Example #8
0
 private void uxObstacleList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     selectedObstacle = (ObstacleModel)uxObstacleList.SelectedValue;
 }