Пример #1
0
    //turn
    //a turn represents one complete interaction cycle 
    //fade in, select destination, fade out, update position
    private IEnumerator Turn() {

        //toggle flag
        _IsInputEnabled = true;
        rotate.IsInputEnabled = _IsInputEnabled;

        //fade in
        fade.ToggleFade();

        //disable previously selected object
        _prevObj.GetComponent<ButtonStates>().SetDisabled();

        //fade delay
        yield return new WaitForSeconds(fade.duration);

        //enable all buttons
        EnableButtons();

        //while
        while (_IsInputEnabled == true) {

            //store selected object
            GameObject obj = null;

            //select object
            yield return StartCoroutine(move.WaitForInput(value => obj = value));

            //check object
            if (obj != null && 
                obj.GetComponent<ButtonStates>().currentState != ButtonStates.State.Disabled) {

                //toggle flag
                _IsInputEnabled = false;
                rotate.IsInputEnabled = _IsInputEnabled;

                //disable all buttons
                DisableButtons();

                //fade out
                fade.ToggleFade();

                //fade delay
                yield return new WaitForSeconds(fade.duration);

                //move to object
                move.MoveTo(obj);

                //check tutorial visibility
                CheckTutorialVisibility(obj);

                //update previous object
                _prevObj = obj;                
            }
        }

        //start next turn
        StartCoroutine(Turn());
    }
Пример #2
0
    //start turn
    public IEnumerator StartTurn() {

        //reset selected object
        _selectObj = null;

        //fade in
        fade.ToggleFade();

        //delay
        yield return new WaitForSeconds(fade.duration);

        //enable interactive objects
        EnableInteractives();

        //disable position object
        _posObj.GetComponent<TouchStates>().SetDisabled();

        //enable input
        IsInputEnabled = true;
    }