Пример #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        float moveHorizontal = Muse.GetAccLeftRight() / 100.0f;
        //Debug.Log (moveHorizontal);
        Vector2 movement = new Vector2(moveHorizontal, 0.0f);

        rb2d.AddForce(movement * speed);
        //Debug.Log (Muse.blinks);
        if (Muse.blinks == 1)
        {
            Vector2 vertForce = new Vector2(0.0f, speed_blink);
            rb2d.AddForce(vertForce * speed);
        }

        if (moveHorizontal < 0.0f && face_flag == 1)
        {
            transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            face_flag            = 0;
        }
        if (moveHorizontal > 0.0f && face_flag == 0)
        {
            transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            face_flag            = 1;
        }

        if (Muse.jaw == 1)
        {
            GenerateBubble();
        }
    }