예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //AmplitudeHeave = 위 아래 / FrequencyHeave = 간격 - max 30
        //AmplitudeRoll = 좌 우 / FrequencyRoll = s - max 10
        //AmplitudePitch = 앞 뒤 / FrequencyPitch = 간격 - max 10
        if (state == true)
        {
            if (actionbool == true)
            {
                anim.SetFloat("Speed", 1);

                CInnoMotion_API.SetOperation(Heave, Roll, Pitch, FHeave, FRoll, FPitch);
                time += Time.deltaTime;
                //pause
                if (time >= 130f)
                {
                    SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
                }
            }
            else
            {
                Init();
            }
        }
        else if (state == false)
        {
            Init();
            anim.SetFloat("Speed", 0);
        }
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        //AmplitudeHeave = 위 아래 / FrequencyHeave = 간격
        //AmplitudeRoll = 좌 우 / FrequencyRoll = 간격
        //AmplitudePitch = 앞 뒤 / FrequencyPitch = 간격

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            if (roll <= 10)
            {
                roll         += (Time.deltaTime * moveSpeed);
                AmplitudeRoll = roll * -1;
            }
            else
            {
                return;
            }

            Debug.Log("LEFT");
            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKey(KeyCode.RightArrow))
        {
            if (-10 <= roll)
            {
                roll         -= (Time.deltaTime * moveSpeed);
                AmplitudeRoll = roll * -1;
            }
            Debug.Log("Right");

            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            if (pitch <= 10)
            {
                pitch         += (Time.deltaTime * moveSpeed);
                AmplitudePitch = pitch;
            }
            Debug.Log("Down");

            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKey(KeyCode.UpArrow))
        {
            if (-10 <= pitch)
            {
                pitch         -= (Time.deltaTime * moveSpeed);
                AmplitudePitch = pitch;
            }
            Debug.Log("Up");

            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKey(KeyCode.PageDown))
        {
            if (-10 <= heave)
            {
                heave         -= (Time.deltaTime * moveSpeed);
                AmplitudeHeave = heave;
            }
            Debug.Log("Jump");

            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKey(KeyCode.PageUp))
        {
            if (heave <= 10)
            {
                heave         += (Time.deltaTime * moveSpeed);
                AmplitudeHeave = heave;
            }
            Debug.Log("Fall");

            CInnoMotion_API.SetOperation(AmplitudeHeave, AmplitudeRoll, AmplitudePitch, FrequencyHeave, FrequencyRoll, FrequencyPitch);
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            heave = 0.0f;
            pitch = 0.0f;
            roll  = 0.0f;

            CInnoMotion_API.SetOperation(0, 0, 0, 0, 0, 0);
        }
    }