예제 #1
0
    void AndControls()
    {
        int touchesNum = Input.touchCount;

        swapwasin = false;
        for (int i = 0; i < touchesNum; i++)
        {
            Vector3 mp = new Vector3(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y, 0);
            mp = ps3(mp);
            if (rleft.isIn(mp))
            {
                MoveLeft();
            }
            if (rright.isIn(mp))
            {
                MoveRight();
            }
            if (rgrenade.isIn(mp))
            {
                throwGrenade.Throw();
            }
            if (rshoot.isIn(mp))
            {
                shot.Check();
            }
            if (rup.isIn(mp) && IsGrounded())
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jump);
            }
            if (rswitch.isIn(mp))
            {
                swapwasin = true;
                if (swapped == false)
                {
                    shot.SwitchWeapons();
                }
            }
            else
            {
            }
        }
        swapped = swapwasin;
    }
예제 #2
0
    void Update()
    {
        Vector3 mp = Input.mousePosition;

        mp = cam.ScreenToWorldPoint(mp);
        if (Input.GetMouseButton(0))
        {
            if (bplay.isIn(mp))
            {
                mplay();
            }
            else if (boptions.isIn(mp))
            {
                moptions();
            }
            else if (bquit.isIn(mp))
            {
                mquit();
            }
        }
    }
    void Update()
    {
        timer -= Time.deltaTime;
        if (timer > 0)
        {
            return;
        }

        Vector3 mp = Input.mousePosition;

        mp = cam.ScreenToWorldPoint(mp);
        if (Input.GetMouseButton(0))
        {
            if (bd.isIn(mp))
            {
                md();
            }
            else if (bm.isIn(mp))
            {
                mm();
            }
        }
    }