コード例 #1
0
    void Update()
    {
        transform.position = vtv.V3Normalize(Camera.main.ScreenToWorldPoint(InputManager.MTPosition()), 1000f);


        if (SkillCaster.readable)
        {
            if (InputManager.MTRightButtonDown())
            {
                //startPos = gamMan.ScreenWorldPosition(InputManager.MTPosition(), skillDetectLayer, 100f);

                /*Ray camRay = Camera.main.ScreenPointToRay (InputManager.MTPosition());
                 * RaycastHit floorHit;
                 * if (Physics.Raycast(camRay, out floorHit, 100f, floorMask))
                 * {
                 *  startPos = vtv.V3Normalize(floorHit.point);
                 * }*/

                //startPos =vtv.V3Normalize(Camera.main.ScreenToWorldPoint(InputManager.MTPosition()), 1f);

                mDown = true;

                //DrawTrail(); // make sure transform.position is renewed!

                startPos = vtv.V3Normalize(Camera.main.ScreenToWorldPoint(InputManager.MTPosition()), 1f);
            }

            else if (InputManager.MTRightButtonUp())
            {
                //endPos = gamMan.ScreenWorldPosition(InputManager.MTPosition(), skillDetectLayer, 100f);

                //endPos = vtv.V3Normalize(Camera.main.ScreenToWorldPoint(InputManager.MTPosition()), 1f);


                mDown  = false;
                endPos = vtv.V3Normalize(Camera.main.ScreenToWorldPoint(InputManager.MTPosition()), 1f);
            }
        }
        else
        {
            mDown = false;
        }
    }
コード例 #2
0
    void CalCenter(List <Vector2> v)
    {
        Vector2 max, min;

        max = v[0];
        min = v[0];


        for (int i = 1; i < v.Count; i++)
        {
            max = Vector2.Max(max, v[i]);
            min = Vector2.Min(min, v[i]);
        }
        cen = v2v.V3Normalize(Camera.main.ScreenToWorldPoint((max + min) / 2), 1f);

        //Debug.Log(cen);
    }