Exemple #1
0
    void Update()
    {
        Animator.SetBool("ReadyStart", Task.State != eTaskState.CannotStart);
        Animator.SetBool("Finished", Task.State == eTaskState.Completed);
        Animator.SetBool("ShowPlayerIcon", Task.PlayerDoingTask != null);
        if (Task.PlayerDoingTask != null)
        {
            PlayerIcon.SetIcon(Task.PlayerDoingTask);
        }
        ProgressBar.fillAmount = Task.Progress;

        TaskTypeIcon.sprite = Task.TaskIcon;
        TaskTypeIcon.gameObject.SetActive(Task.TaskIcon != null);

        bool showTimer  = false;
        var  playerTask = Task as PlayerTask;

        if (playerTask != null)
        {
            var time = playerTask.TimeUntilDue;
            TimeLabel.text = TimeUtility.GetTimeString(time);
            showTimer      = true;
        }
        Animator.SetBool("ShowTimer", showTimer);

        bool canDoTask = Task.State != eTaskState.CannotStart &&
                         Task.State != eTaskState.Completed;

        TimeLabel.gameObject.SetActive(showTimer && canDoTask);
    }