Exemple #1
0
    IEnumerator IE_TASK()
    {
        _IS_IE_TASK = true;

        yield return(new WaitForSeconds(Random.Range(1, 5)));

        _Task = S_Task.GetRandomTask();

        if (_ControllContainer != null)
        {
            _ControllContainer.StartWork();
        }

        yield return(new WaitForSeconds(1));

        while (_Task.CouldSubTask() > 0 && !_Task.IsFailed() && !_Room.IS_FINISH())
        {
            _Task.TimerAdd(-0.5f);
            if (_Task.GetTimer() <= 0)
            {
                _Task.Failed();
            }


            yield return(new WaitForSeconds(0.5f));
        }

        yield return(new WaitForSeconds(0.5f));

        if (_ControllContainer != null)
        {
            _ControllContainer.PreEndWork();
        }

        if (!_Room.IS_FINISH())
        {
            _Room.ScoreEvent().Event_Task_Finish(_Task.IsFailed(), _Task.GetReward());
        }

        _Task = null;
        yield return(new WaitForSeconds(2f));

        if (_ControllContainer != null)
        {
            _ControllContainer.EndWork();
        }

        yield return(new WaitForSeconds(Random.Range(1, 10)));


        _IS_IE_TASK = false;
    }
Exemple #2
0
    public void E_Chest(S_A_Chest Ch_)
    {
        if (_Task != null)
        {
            S_Task_Element SE = _Task.GetSubTask(_Task.CouldSubTask() - 1);
            if (Ch_._ID == SE._Chest._ID)
            {
                SE._Could--;
            }
            else
            {
                _Task.Failed();
            }

            if (SE._Could <= 0)
            {
                _Task.DeleteTask(_Task.CouldSubTask() - 1);
            }
        }
    }