Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (!DEBUG)
        {
            m_currentAcceleration = Input.acceleration;
        }
        else
        {
            m_shakeCount = 5;
        }

        if (m_trigger)
        {
            m_passedTime += Time.deltaTime;
            if (m_passedTime <= m_capableTime)
            {
                if (Vector3.Dot(m_currentAcceleration, m_preAcceleration) < 0)
                {
                    m_shakeCount++;
                }

                if (m_shakeCount >= 5)
                {
                    int stageC = DataManager.Instance.CurrentData.stageDatas.Length;
                    Debug.Log(DataManager.Instance.CurrentData);
                    for (int i = 0; i < stageC; i++)
                    {
                        DataManager.Instance.CurrentData.stageDatas[i] |= 0xFFFF;
                    }
                    Debug.Log(DataManager.Instance.CurrentData);
                    DataManager.Instance.SaveCurrentFIle();
                    DataManager.Instance.ReloadFile();
                    m_toggleSwitch.SwapActivity();
                    m_trigger = false;
                }
            }
            else
            {
                m_trigger = false;
            }
        }
        m_preAcceleration = m_currentAcceleration;
    }