static bool[] GetButtonsToPress(SpotIndex spotIndex)
    {
        switch (spotIndex)
        {
        case SpotIndex.L: return(new bool[] { true, false, false, false });

        case SpotIndex.B: return(new bool[] { false, true, false, false });

        case SpotIndex.R: return(new bool[] { false, false, true, false });

        case SpotIndex.T: return(new bool[] { false, false, false, true });

        case SpotIndex.LB: return(new bool[] { true, true, false, false });

        case SpotIndex.BR: return(new bool[] { false, true, true, false });

        case SpotIndex.RT: return(new bool[] { false, false, true, true });

        case SpotIndex.TL: return(new bool[] { true, false, false, true });

        case SpotIndex.LBT: return(new bool[] { true, true, false, true });

        case SpotIndex.BRT: return(new bool[] { false, true, true, true });

        case SpotIndex.LBRT: return(new bool[] { true, true, true, true });
        }

        throw new System.ArgumentException();
    }
    void StartRound()
    {
        // Clear the buttons list
        for (var i = 0; i < 4; i++)
        {
            m_fireButtonsWereHit[i] = false;
        }

        // Pick a spot (not the same)
        SpotIndex lastSpotIndex = m_spotIndex;

        while (lastSpotIndex == m_spotIndex)
        {
            m_spotIndex = PickSpotIndex();
        }

        // Update the look of buttons
        ResetButtons();
        bool[] buttonsToPress = GetButtonsToPress(m_spotIndex);
        for (var i = 0; i < 4; i++)
        {
            if (buttonsToPress[i])
            {
                m_fireButtons[i].GetComponent <SpriteRenderer>().sprite = m_buttonToPressSprite;
            }
        }

        // Remove images if shown
        m_hurtImage.SetActive(false);
        m_blastImage.SetActive(false);
    }
    static int CountPointsForSpot(SpotIndex spotIndex)
    {
        switch (spotIndex)
        {
        case SpotIndex.L:
        case SpotIndex.B:
        case SpotIndex.R:
        case SpotIndex.T:
            return(1);

        case SpotIndex.LB:
        case SpotIndex.BR:
        case SpotIndex.RT:
        case SpotIndex.TL:
            return(2);

        case SpotIndex.LBT:
        case SpotIndex.BRT:
            return(3);

        case SpotIndex.LBRT:
            return(4);
        }

        throw new System.ArgumentException();
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        m_ObjectEnters = false;
        Interactable newNearestInteractable = null;

        newNearestInteractable = Detect();

        if (m_currentInteractable != newNearestInteractable)
        {
            m_currentInteractable = newNearestInteractable;
        }

        //if (m_DropDisplayed && m_ObjectEnters)
        //{
        //    m_DropDisplayed = false;
        //    m_ObjectEnters = false;
        //}

        if (m_currentInteractable != null)
        {
            m_DropDisplayed = false;
            DisplayUIDrop(false);
            UnselectSprite(m_DropIndex);
        }

        if (!m_DropDisplayed)
        {
            DisplayBind();
        }
        m_SelectedSpot = (SpotIndex)m_selectedIndex;

        if (m_DropDisplayed)
        {
            DropSelect();
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            if (m_Attaching || CheckSpotsEmpty())
            {
                m_DropDisplayed = false;
                DisplayUIDrop(false);
                DisplayAllAttach(false);
            }
            else
            {
                if (m_currentInteractable == null)
                {
                    m_DropDisplayed = true;
                    Dropintent();
                }
            }
        }
    }