コード例 #1
0
    //	RTS selection function, judgement for selectable obj in or not in selction area from camera view angle
    public bool IsWithinSelectionBounds(GameObject gameObject)
    {
        if (!mouseAreaSelec)
        {
            return(false);
        }

        var cam            = playerCam;
        var viewportBounds =
            Utils_RTS_Draw.GetViewportBounds(cam, curMousPos, Input.mousePosition);

        return(viewportBounds.Contains(
                   cam.WorldToViewportPoint(gameObject.transform.position)));           //	use bounds() search if obj is in selection area
    }