예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.UpArrow))
        {
            fan.IncreasePower();
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            fan.DecreasePower();
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            fanRB.velocity = new Vector3(-1 * speedX, fanRB.velocity.y, 0);
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            fanRB.velocity = new Vector3(1 * speedX, fanRB.velocity.y, 0);
        }

        if (!(Input.GetKey(KeyCode.LeftArrow)) && !(Input.GetKey(KeyCode.RightArrow)))
        {
            fanRB.velocity = new Vector3(0, fanRB.velocity.y, 0);
        }
    }