示例#1
0
    void FixedUpdate()
    {
        if (m_Steps > 0)
        {
            Quaternion rotation = Quaternion.identity;
            float      gradi;

            if (m_Orario)
            {
                gradi = 90f;
            }
            else
            {
                gradi = -90f;
            }

            switch (m_DaRoutare)
            {
            case 1:
                rotation.eulerAngles           = new Vector3(m_FrontAnim.transform.rotation.eulerAngles.x, m_FrontAnim.transform.rotation.eulerAngles.y, m_FrontAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_FrontAnim.transform.rotation = rotation;
                break;

            case 2:
                rotation.eulerAngles          = new Vector3(m_BackAnim.transform.rotation.eulerAngles.x, m_BackAnim.transform.rotation.eulerAngles.y, m_BackAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_BackAnim.transform.rotation = rotation;
                break;

            case 3:
                rotation.eulerAngles          = new Vector3(m_LeftAnim.transform.rotation.eulerAngles.x, m_LeftAnim.transform.rotation.eulerAngles.y, m_LeftAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_LeftAnim.transform.rotation = rotation;
                break;

            case 4:
                rotation.eulerAngles           = new Vector3(m_RightAnim.transform.rotation.eulerAngles.x, m_RightAnim.transform.rotation.eulerAngles.y, m_RightAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_RightAnim.transform.rotation = rotation;
                break;

            case 5:
                rotation.eulerAngles        = new Vector3(m_UpAnim.transform.rotation.eulerAngles.x, m_UpAnim.transform.rotation.eulerAngles.y, m_UpAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_UpAnim.transform.rotation = rotation;
                break;

            case 6:
                rotation.eulerAngles          = new Vector3(m_DownAnim.transform.rotation.eulerAngles.x, m_DownAnim.transform.rotation.eulerAngles.y, m_DownAnim.transform.rotation.eulerAngles.z + gradi / m_Frames);
                m_DownAnim.transform.rotation = rotation;
                break;
            }

            m_Steps -= 1;


            if (m_Steps == 0)
            {
                m_FrontAnim.SetActive(false);
                m_BackAnim.SetActive(false);
                m_LeftAnim.SetActive(false);
                m_RightAnim.SetActive(false);
                m_UpAnim.SetActive(false);
                m_DownAnim.SetActive(false);

                m_StatoCubo.AccendiTuttiCubetti();

                switch (m_DaRoutare)
                {
                case 1:
                    rotation.eulerAngles           = new Vector3(m_FrontAnim.transform.rotation.eulerAngles.x, m_FrontAnim.transform.rotation.eulerAngles.y, m_FrontAnim.transform.rotation.eulerAngles.z - gradi);
                    m_FrontAnim.transform.rotation = rotation;
                    break;

                case 2:
                    rotation.eulerAngles          = new Vector3(m_BackAnim.transform.rotation.eulerAngles.x, m_BackAnim.transform.rotation.eulerAngles.y, m_BackAnim.transform.rotation.eulerAngles.z - gradi);
                    m_BackAnim.transform.rotation = rotation;
                    break;

                case 3:
                    rotation.eulerAngles          = new Vector3(m_LeftAnim.transform.rotation.eulerAngles.x, m_LeftAnim.transform.rotation.eulerAngles.y, m_LeftAnim.transform.rotation.eulerAngles.z - gradi);
                    m_LeftAnim.transform.rotation = rotation;
                    break;

                case 4:
                    rotation.eulerAngles           = new Vector3(m_RightAnim.transform.rotation.eulerAngles.x, m_RightAnim.transform.rotation.eulerAngles.y, m_RightAnim.transform.rotation.eulerAngles.z - gradi);
                    m_RightAnim.transform.rotation = rotation;
                    break;

                case 5:
                    rotation.eulerAngles        = new Vector3(m_UpAnim.transform.rotation.eulerAngles.x, m_UpAnim.transform.rotation.eulerAngles.y, m_UpAnim.transform.rotation.eulerAngles.z - gradi);
                    m_UpAnim.transform.rotation = rotation;
                    break;

                case 6:
                    rotation.eulerAngles          = new Vector3(m_DownAnim.transform.rotation.eulerAngles.x, m_DownAnim.transform.rotation.eulerAngles.y, m_DownAnim.transform.rotation.eulerAngles.z - gradi);
                    m_DownAnim.transform.rotation = rotation;
                    break;
                }

                if (m_Continua)
                {
                    m_Index++;
                    if (m_Index == m_NumMosse)
                    {
                        m_Continua = false;
                        if (m_StoMescolando)
                        {
                            m_StoMescolando = false;
                        }
                        m_Frames = 15;
                    }
                    else
                    {
                        switch (m_Mosse[m_Index])
                        {
                        case 1:
                            m_StatoCubo.FrontOrario();
                            break;

                        case 2:
                            m_StatoCubo.FrontAntioriario();
                            break;

                        case 3:
                            m_StatoCubo.BackOrario();
                            break;

                        case 4:
                            m_StatoCubo.BackAntioriario();
                            break;

                        case 5:
                            m_StatoCubo.LeftOrario();
                            break;

                        case 6:
                            m_StatoCubo.LeftAntioriario();
                            break;

                        case 7:
                            m_StatoCubo.RightOrario();
                            break;

                        case 8:
                            m_StatoCubo.RightAntioriario();
                            break;

                        case 9:
                            m_StatoCubo.UpOrario();
                            break;

                        case 10:
                            m_StatoCubo.UpAntioriario();
                            break;

                        case 11:
                            m_StatoCubo.DownOrario();
                            break;

                        case 12:
                            m_StatoCubo.DownAntioriario();
                            break;
                        }
                        m_SuonoRotazione.enabled = false;
                        m_SuonoRotazione.enabled = true;
                    }
                }
            }
        }
    }
示例#2
0
    void OnMouseOver()
    {
        if (m_Camera.isFermo() && m_Animatore.isFermo() && m_GameManager.IsGameRunning())
        {
            m_Sprite.enabled = true;
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                switch (m_Action)
                {
                case 1:
                    m_StatoCubo.FrontOrario();
                    break;

                case 2:
                    m_StatoCubo.FrontAntioriario();
                    break;

                case 3:
                    m_StatoCubo.BackOrario();
                    break;

                case 4:
                    m_StatoCubo.BackAntioriario();
                    break;

                case 5:
                    m_StatoCubo.LeftOrario();
                    break;

                case 6:
                    m_StatoCubo.LeftAntioriario();
                    break;

                case 7:
                    m_StatoCubo.RightOrario();
                    break;

                case 8:
                    m_StatoCubo.RightAntioriario();
                    break;

                case 9:
                    m_StatoCubo.UpOrario();
                    break;

                case 10:
                    m_StatoCubo.UpAntioriario();
                    break;

                case 11:
                    m_StatoCubo.DownOrario();
                    break;

                case 12:
                    m_StatoCubo.DownAntioriario();
                    break;
                }
                m_SuonoRotazione.enabled = false;
                m_SuonoRotazione.enabled = true;
                m_GameManager.HoFattoUnaMossa();
                m_GameManager.ControllaSeHoVinto();
            }
        }
        else
        {
            m_Sprite.enabled = false;
        }
    }