void Start()
    {
        buff_fire = false;
        fire_l_hand.SetActive(false);
        fire_l_foot.SetActive(false);
        fire_r_hand.SetActive(false);
        fire_r_foot.SetActive(false);

        anim_Control_camera_sprite.gameObject.GetComponent <Image> ().color    = new Color(255, 255, 255, 0);
        anim_Control_character_sprite.gameObject.GetComponent <Image> ().color = new Color(255, 255, 255, 0);

        can_change_camera = true;
        can_atk           = true;
        can_buff_fire     = true;

        time_res_camera_elapsed = 0;
        time_res_atk_elapsed    = 0;
        time_res_e_elapsed      = 0;

        anim_Control_player = GetComponent <Animator> ();
        atual_camera        = cameras.ISO;

        camera_ISO.SetActive(true);

        camera_3.SetActive(false);
        camera_1.SetActive(false);

        //camera_3.SetActive (true);
        //camera_1.SetActive (true);
    }
        /// <summary>
        /// Copy the desired portions of the deserialized model data to the view model collection of cameras
        /// </summary>
        /// <param name="model">Deserializeed result from API call</param>
        /// <param name="viewModel">Collection of view model items</param>
        /// <param name="maxResults">Maximum number of results to assign to view model (0 = assign all results)</param>
        /// <returns>Indicator of whether items were left out of the view model due to max size restrictions</returns>
        public static Boolean PopulateViewModel(cameras model, ObservableCollection<TomTomCameraViewModel> viewModel, Int32 maxResults = 0)
        {
            Int32 sequence = 0;

            // set up a staging list for applying any filters/max # of items returned, etc.
            var stagingList = new List<TomTomCameraViewModel>();

            // clear the view model first
            viewModel.Clear();

            // pull desired fields from model and insert into view model
            if (model.CameraList != null)
                foreach (var camera in
                            (from c in model.CameraList select new TomTomCameraViewModel()
                                {
                                    Sequence = ++sequence,
                                    CameraId = c.cameraId,
                                    Name = c.cameraName,
                                    Orientation = c.orientation.Replace("Traffic closest to camera is t", "T"),
                                    RefreshRate = c.refreshRate,
                                    Latitude = c.latitude,
                                    Longitude = c.longitude
                                }))
                    stagingList.Add(camera);

            // apply max count if provided
            var maxResultsExceeded = (maxResults > 0) && (stagingList.Count > maxResults);
            foreach (var s in stagingList.Take(maxResultsExceeded ? maxResults : stagingList.Count))
                viewModel.Add(s);

            return maxResultsExceeded;
        }
Beispiel #3
0
        /// <summary>
        /// Copy the desired portions of the deserialized model data to the view model collection of cameras
        /// </summary>
        /// <param name="model">Deserializeed result from API call</param>
        /// <param name="viewModel">Collection of view model items</param>
        /// <param name="centerLatitude">Latitude of center point of current map view</param>
        /// <param name="centerLongitude">Longitude of center point of current map view</param>
        /// <param name="maxResults">Maximum number of results to assign to view model (0 = assign all results)</param>
        /// <returns>Indicator of whether items were left out of the view model due to max size restrictions</returns>
        public static Boolean PopulateViewModel(cameras model, ObservableCollection <TomTomCameraViewModel> viewModel, LatLong centerPoint, Int32 maxResults = 0)
        {
            Int32 sequence = 0;

            // set up a staging list for applying any filters/max # of items returned, etc.
            var stagingList = new List <TomTomCameraViewModel>();

            // clear the view model first
            viewModel.Clear();

            // pull desired fields from model and insert into view model
            if (model.CameraList != null)
            {
                foreach (var camera in
                         (from c in model.CameraList
                          select new TomTomCameraViewModel()
                {
                    CameraId = c.cameraId,
                    Name = c.cameraName,
                    Orientation = c.orientation.Replace("Traffic closest to camera is t", "T"),
                    RefreshRate = c.refreshRate / 1000d,
                    Position = new LatLong(c.latitude, c.longitude),
                    DistanceFromCenter = MapUtilities.HaversineDistance(centerPoint, new LatLong(c.latitude, c.longitude)),
                    TimeLapse = new ObservableCollection <TimeLapseImage>()
                }))
                {
                    stagingList.Add(camera);
                }
            }

            // apply max count if provided
            var resultsWereTruncated = (maxResults > 0) && (stagingList.Count > maxResults);

            foreach (var s in stagingList
                     .OrderBy((c) => c.DistanceFromCenter)
                     .Take(resultsWereTruncated ? maxResults : stagingList.Count))
            {
                s.Sequence = ++sequence;
                viewModel.Add(s);
            }

            return(resultsWereTruncated);
        }
        public List <cameras> GetList()
        {
            var data = pg.Query("SELECT * FROM cameras").Fetch();

            var ret = new List <cameras>();

            foreach (DataRow dr in data.Rows)
            {
                var item = new cameras
                {
                    id = Convert.ToInt64(dr["id"]),
                    currentfield_fk = Convert.ToInt64(dr["currentfield_fk"]),
                    name            = Convert.ToString(dr["name"]),
                    geolat          = Convert.ToString(dr["geolat"]),
                    geolon          = Convert.ToString(dr["geolon"])
                };

                ret.Add(item);
            }

            return(ret);
        }
        /// <summary>
        /// Copy the desired portions of the deserialized model data to the view model collection of cameras
        /// </summary>
        /// <param name="model">Deserializeed result from API call</param>
        /// <param name="viewModel">Collection of view model items</param>
        /// <param name="centerLatitude">Latitude of center point of current map view</param>
        /// <param name="centerLongitude">Longitude of center point of current map view</param>
        /// <param name="maxResults">Maximum number of results to assign to view model (0 = assign all results)</param>
        /// <returns>Indicator of whether items were left out of the view model due to max size restrictions</returns>
        public static Boolean PopulateViewModel(cameras model, ObservableCollection<TomTomCameraViewModel> viewModel, LatLong centerPoint, Int32 maxResults = 0)
        {
            Int32 sequence = 0;

            // set up a staging list for applying any filters/max # of items returned, etc.
            var stagingList = new List<TomTomCameraViewModel>();

            // clear the view model first
            viewModel.Clear();

            // pull desired fields from model and insert into view model
            if (model.CameraList != null)
                foreach (var camera in
                            (from c in model.CameraList
                             select new TomTomCameraViewModel()
                                 {
                                     CameraId = c.cameraId,
                                     Name = c.cameraName,
                                     Orientation = c.orientation.Replace("Traffic closest to camera is t", "T"),
                                     RefreshRate = c.refreshRate,
                                     Position = new LatLong(c.latitude, c.longitude),
                                     DistanceFromCenter = MapUtilities.HaversineDistance(centerPoint, new LatLong(c.latitude, c.longitude))
                                 }))
                    stagingList.Add(camera);

            // apply max count if provided
            var resultsWereTruncated = (maxResults > 0) && (stagingList.Count > maxResults);
            foreach (var s in stagingList
                              .OrderBy((c) => c.DistanceFromCenter)
                              .Take(resultsWereTruncated ? maxResults : stagingList.Count))
            {
                s.Sequence = ++sequence;
                viewModel.Add(s);
            }

            return resultsWereTruncated;
        }
    void camera_change()
    {
        if (Input.GetButtonDown("ChangeCamera") && can_change_camera)
        {
            if (atual_camera == cameras.ISO)
            {
                atual_camera = cameras.T3;
                camera_3.SetActive(true);

                camera_ISO.SetActive(false);
                camera_1.SetActive(false);


                anim_Control_camera_panel.SetTrigger("change");
                anim_Control_camera_sprite.gameObject.GetComponent <Image> ().color    = new Color(255, 255, 255, 255);
                anim_Control_character_sprite.gameObject.GetComponent <Image> ().color = new Color(255, 255, 255, 255);
                anim_Control_camera_sprite.SetTrigger("change");
                Invoke("offPanel", 2f);

                can_change_camera       = false;
                time_res_camera_elapsed = 0;
            }
            else if (atual_camera == cameras.T3)
            {
                atual_camera = cameras.T1;

                camera_1.SetActive(true);

                camera_ISO.SetActive(false);
                camera_3.SetActive(false);

                anim_Control_camera_panel.SetTrigger("change");
                anim_Control_camera_sprite.gameObject.GetComponent <Image> ().color    = new Color(255, 255, 255, 255);
                anim_Control_character_sprite.gameObject.GetComponent <Image> ().color = new Color(255, 255, 255, 255);
                anim_Control_camera_sprite.SetTrigger("change");
                anim_Control_character_sprite.SetTrigger("change");
                Invoke("offPanel", 2f);

                can_change_camera       = false;
                time_res_camera_elapsed = 0;
            }
            else
            {
                atual_camera = cameras.ISO;

                camera_ISO.SetActive(true);

                camera_3.SetActive(false);
                camera_1.SetActive(false);

                anim_Control_camera_panel.SetTrigger("change");
                anim_Control_camera_sprite.gameObject.GetComponent <Image> ().color    = new Color(255, 255, 255, 255);
                anim_Control_character_sprite.gameObject.GetComponent <Image> ().color = new Color(255, 255, 255, 255);
                anim_Control_camera_sprite.SetTrigger("change");
                anim_Control_character_sprite.SetTrigger("change");
                Invoke("offPanel", 2f);

                can_change_camera       = false;
                time_res_camera_elapsed = 0;
            }
        }
        if (!can_change_camera)
        {
            time_res_camera_elapsed += Time.deltaTime;
            if (time_res_camera_elapsed >= time_res_camera)
            {
                can_change_camera       = true;
                time_res_camera_elapsed = 0;
            }
        }
    }