Ejemplo n.º 1
0
 private void UpdateUI(float speed, string destination, float travel_time, string squad_name, bool show)
 {
     if (show)
     {
         _animator.SetTrigger("Open");
     }
     else
     {
         _animator.SetTrigger("Closed");
     }
     this.speed.text       = "Speed: " + speed + "km/h";
     this.destination.text = "Destination: " + destination + ".";
     this.travel_time.text = "Duration: " + TimeLib.HoursToSpan(travel_time);
     this.squad_name.text  = squad_name;
 }
Ejemplo n.º 2
0
    void Start()
    {
        destination_name     = "Bastia";
        _speed_km            = speed * 10;
        _start_pos           = new Vector2(transform.position.x, transform.position.y);
        _destination_pos     = new Vector2(destination.transform.position.x, destination.transform.position.y);
        _distance            = Vector2.Distance(_start_pos, _destination_pos); // 20Km = 2units.
        _travel_time         = _distance / speed;                              // give travel_time in hour.
        _travel_time_seconds = _travel_time * 3600f;
        _travel_action       = TimedActionFactory.CreateTimedAction(_travel_time_seconds, DateTime.Now);


        // For debugging purposes.
        Debug.Log("Travel distance: " + _distance * 10 + "km.");
        Debug.Log("Speed: " + _speed_km + "km/h");
        Debug.Log("Travel time: " + TimeLib.HoursToSpan(_travel_time));
    }