Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (MousePos.MouseLeft())
     {
         Debug.Log(MousePos.MousePosition());
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        //タンス横用をタッチしたとき
        if (Mouse.MouseLeft() && Tansu == false)
        {
            MousePos = Mouse.MousePosition();
            if (MousePos.x >= TansuPos.x && MousePos.x <= TansuPos.x + 1 && MousePos.y >= TansuPos.y - 1 && MousePos.y <= TansuPos.y)
            {
                if (MousePos.y - playertouch.gameObject.transform.position.y < TansuRange && MousePos.y - playertouch.gameObject.transform.position.y > -(TansuRange) &&
                    MousePos.x - playertouch.gameObject.transform.position.x > -(TansuRange) && MousePos.x - playertouch.gameObject.transform.position.x < TansuRange)
                {
                    Tansu = true;
                    anim.Play("book");
                }
            }
        }

        //タンス縦用をタッチしたとき
        if (Mouse.MouseLeft() && Tansu2 == false)
        {
            MousePos = Mouse.MousePosition();
            if (MousePos.x >= TansuTatePos.x && MousePos.x <= TansuTatePos.x + 1 && MousePos.y >= TansuTatePos.y - 1 && MousePos.y <= TansuTatePos.y)
            {
                if (MousePos.y - playertouch.gameObject.transform.position.y < TansuRange && MousePos.y - playertouch.gameObject.transform.position.y > -(TansuRange) &&
                    MousePos.x - playertouch.gameObject.transform.position.x > -(TansuRange) && MousePos.x - playertouch.gameObject.transform.position.x < TansuRange)
                {
                    Tansu2 = true;
                    anim.Play("book_anim");
                }
            }
        }

        //時計前をタッチしたとき
        if (Mouse.MouseLeft() && Clock == false)
        {
            MousePos = Mouse.MousePosition();
            if (MousePos.x >= ClockPos.x && MousePos.x <= ClockPos.x + 1 &&
                MousePos.y >= ClockPos.y - 1 && MousePos.y <= ClockPos.y)
            {
                if (MousePos.y - playertouch.gameObject.transform.position.y < ClockRangeY && MousePos.y - playertouch.gameObject.transform.position.y > -(ClockRangeY) &&
                    MousePos.x - playertouch.gameObject.transform.position.x > -(ClockRangeX) && MousePos.x - playertouch.gameObject.transform.position.x < ClockRangeX)
                {
                    Clock = true;
                    anim.Play("Clock");
                }
            }
        }

        //時計右をタッチしたとき
        if (Mouse.MouseLeft() && clock_L == false)
        {
            MousePos = Mouse.MousePosition();
            if (MousePos.x >= ClockPos.x && MousePos.x <= ClockPos.x + 1 &&
                MousePos.y >= ClockPos.y - 1 && MousePos.y <= ClockPos.y)
            {
                if (MousePos.y - playertouch.gameObject.transform.position.y < ClockRangeY && MousePos.y - playertouch.gameObject.transform.position.y > -(ClockRangeY) &&
                    MousePos.x - playertouch.gameObject.transform.position.x > -(ClockRangeX) && MousePos.x - playertouch.gameObject.transform.position.x < ClockRangeX)
                {
                    clock_L = true;
                    anim.Play("Clock_L");
                }
            }
        }

        if (Mouse.MouseLeft() && piano == false)
        {
            MousePos = Mouse.MousePosition();
            if (MousePos.x >= ClockPos.x && MousePos.x <= ClockPos.x + 1 &&
                MousePos.y >= ClockPos.y - 1 && MousePos.y <= ClockPos.y)
            {
                if (MousePos.y - playertouch.gameObject.transform.position.y < ClockRangeY && MousePos.y - playertouch.gameObject.transform.position.y > -(ClockRangeY) &&
                    MousePos.x - playertouch.gameObject.transform.position.x > -(ClockRangeX) && MousePos.x - playertouch.gameObject.transform.position.x < ClockRangeX)
                {
                    piano = true;
                    anim.Play("piano");
                }
            }
        }

        ClockTouch();
        TansuTouch();
    }