Пример #1
0
    // Use this for initialization
    void Start()
    {
        equiped = zEquips.nothing;

        eload    = FindObjectOfType <EquipLoaded>();
        equipGet = FindObjectOfType <EquipGet>();

        transform.position = equipLayout[0].position;
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        //equipmentGrid[row][col] = 0;

        if (Input.GetAxisRaw("Vertical") > 0) // W
        {
            if (m_yAxisInUse == false)
            {
                if (col > minCol)
                {
                    col--;
                }

                Debug.Log(col);

                m_yAxisInUse = true;
            }
        }
        else if (Input.GetAxisRaw("Horizontal") < 0) // A
        {
            if (m_xAxisInUse == false)
            {
                if (row > minRow)
                {
                    row--;
                }

                Debug.Log(row);

                m_xAxisInUse = true;
            }
        }
        else if (Input.GetAxisRaw("Vertical") < 0) // S
        {
            if (m_yAxisInUse == false)
            {
                if (col < maxCol)
                {
                    col++;
                }

                Debug.Log(col);

                m_yAxisInUse = true;
            }
        }
        else if (Input.GetAxisRaw("Horizontal") > 0) // D
        {
            if (m_xAxisInUse == false)
            {
                if (row < maxRow)
                {
                    row++;
                }

                Debug.Log(row);

                m_xAxisInUse = true;
            }
        }

        if (Input.GetAxisRaw("Vertical") == 0)
        {
            m_yAxisInUse = false;
        }
        if (Input.GetAxisRaw("Horizontal") == 0)
        {
            m_xAxisInUse = false;
        }

        if (equipGet.equipGot[5] == true)
        {
            equipLayoutSprite[5].sprite = (Sprite)AssetDatabase.LoadAssetAtPath("Assets/Sprite/VirgoRaiment.png", typeof(Sprite));
        }

        if (row == 0 && col == 0)
        {
            transform.position = equipLayout[0].position;
        }
        else if (row == 1 && col == 0)
        {
            transform.position = equipLayout[1].position;
        }
        else if (row == 2 && col == 0)
        {
            transform.position = equipLayout[2].position;
        }
        else if (row == 3 && col == 0)
        {
            transform.position = equipLayout[3].position;
        }
        else if (row == 0 && col == 1)
        {
            transform.position = equipLayout[4].position;
        }
        else if (row == 1 && col == 1)
        {
            transform.position = equipLayout[5].position;
        }
        else if (row == 2 && col == 1)
        {
            transform.position = equipLayout[6].position;
        }
        else if (row == 3 && col == 1)
        {
            transform.position = equipLayout[7].position;
        }
        else if (row == 0 && col == 2)
        {
            transform.position = equipLayout[8].position;
        }
        else if (row == 1 && col == 2)
        {
            transform.position = equipLayout[9].position;
        }
        else if (row == 2 && col == 2)
        {
            transform.position = equipLayout[10].position;
        }
        else if (row == 3 && col == 2)
        {
            transform.position = equipLayout[11].position;
        }

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (row == 0 && col == 0 && equipGet.equipGot[0] == true)
            {
                equiped = zEquips.leo;
            }
            else if (row == 1 && col == 0 && equipGet.equipGot[1] == true)
            {
                equiped = zEquips.cancer;
            }
            else if (row == 2 && col == 0 && equipGet.equipGot[2] == true)
            {
                equiped = zEquips.pisces;
            }
            else if (row == 3 && col == 0 && equipGet.equipGot[3] == true)
            {
                equiped = zEquips.scorpius;
            }
            else if (row == 0 && col == 1 && equipGet.equipGot[4] == true)
            {
                equiped = zEquips.aquarius;
            }
            else if (row == 1 && col == 1 && equipGet.equipGot[5] == true)
            {
                equiped = zEquips.virgo;
            }
            else if (row == 2 && col == 1 && equipGet.equipGot[6] == true)
            {
                equiped = zEquips.taurus;
            }
            else if (row == 3 && col == 1 && equipGet.equipGot[7] == true)
            {
                equiped = zEquips.gemini;
            }
            else if (row == 0 && col == 2 && equipGet.equipGot[8] == true)
            {
                equiped = zEquips.libra;
            }
            else if (row == 1 && col == 2 && equipGet.equipGot[9] == true)
            {
                equiped = zEquips.capricorn;
            }
            else if (row == 2 && col == 2 && equipGet.equipGot[10] == true)
            {
                equiped = zEquips.aries;
            }
            else if (row == 3 && col == 2 && equipGet.equipGot[11] == true)
            {
                equiped = zEquips.capricorn;
            }
        }

        if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            equiped = zEquips.nothing;
        }
    }