Ejemplo n.º 1
0
    public void Minimize()
    {
        minimized = true;
        minimizeButton.GetComponent <Image>().color = minimized ? minimizedColor : maximizedColor;

        minState          = MinimizeState.CLOSING;
        stateChangedStart = Time.time;
    }
Ejemplo n.º 2
0
 public Graph Resolve()
 {
     _state = new MinimizeState(_afd);
     _state.RemoveNotAcessibleNodes(_operands, _afd);
     _state.ResolveProgramFunction(_operands);
     _state.InitTable();
     _state.Mark();
     _state.PairAnalysis(_operands);
     _state.Union();
     _state.Generate(_operands);
     _state.RemoveNotAccessibleNodesFromMinimized(_operands);
     return(_state.GetMinimizedGraph());
 }
Ejemplo n.º 3
0
    private void Start()
    {
        minState          = MinimizeState.IDLE;
        saveState         = SaveState.FIRST_ATTEMPT;
        stateChangedStart = 0f;

        wordRect  = wordObject.GetComponent <RectTransform>();
        wordDim   = new Vector2(wordRect.rect.width, wordRect.rect.height);
        minimized = false;

        startOptionsWindow.SetActive(false);

        AudioManager.instance.PlayStartSound();
    }
Ejemplo n.º 4
0
    public void MinimizedClicked()
    {
        minimized = !minimized;
        minimizeButton.GetComponent <Image>().color = minimized ? minimizedColor : maximizedColor;

        if (minimized)
        {
            minState = MinimizeState.CLOSING;
        }
        else
        {
            minState = MinimizeState.OPENING;
        }
        stateChangedStart = Time.time;
    }
Ejemplo n.º 5
0
    private void Update()
    {
        // Save taken animation
        if (saveTaken)
        {
            if (Time.time - timeSavedTaken > 15)
            {
                saveTaken = false;
                StartErasing();
            }
        }

        // Erase themes animation
        if (eraseThemes)
        {
            if (Time.time - lastErase > delay)
            {
                lastErase = Time.time;

                if (jamThemes.text.Length > 0)
                {
                    jamThemes.text = jamThemes.text.Substring(0, jamThemes.text.Length - 2);
                }
                else
                {
                    eraseThemes            = false;
                    jamThemes.interactable = true;

                    fileErased = true;
                    timeErased = Time.time;
                }
            }
        }

        // Start game
        if (fileErased && (Time.time - timeErased > 10))
        {
            fileErased = false;
            StartGame();
        }

        // Hide Start menu if clicked outside of the start button
        if (Input.GetMouseButton(0) && Input.mousePosition.x > 120 && Input.mousePosition.y > 30)
        {
            startOptionsWindow.SetActive(false);
        }

        // Animate minimization
        if (minState != MinimizeState.IDLE)
        {
            float dTime = Time.time - stateChangedStart;
            float ratio = 1f;

            if (dTime >= minimizeDelay)
            {
                // End ratio
                ratio = minState == MinimizeState.CLOSING ? 1 - ratio : ratio;

                // Stop animation
                wordObject.GetComponent <CanvasGroup>().interactable = minState == MinimizeState.OPENING;
                minState = MinimizeState.IDLE;
            }
            else
            {
                // Compute ratio
                ratio = dTime / minimizeDelay;
                ratio = minState == MinimizeState.CLOSING ? 1 - ratio : ratio;
            }

            wordRect.offsetMin = new Vector2(130 * (1 - ratio), wordRect.offsetMin.y);
            wordRect.offsetMax = new Vector2((350 - wordDim.x) * (1 - ratio), -wordDim.y * (1 - ratio));
            wordObject.GetComponent <CanvasGroup>().alpha = ratio;
        }
    }