Exemplo n.º 1
0
    /// <summary>
    /// 检测是否抓到
    /// </summary>
    public bool Check(GameObject ripCenter, float radius, float angle, ref GameObject ripTarget)
    {
        bool hit = false;

        ripTarget = null;
        for (int i = 0; i < targetList.Count; i++)
        {
            RipTargetInfo targetInfo = targetList[i];
            if (Check(ripCenter, radius, angle, targetInfo.target, targetInfo.radius))
            {
                hit       = true;
                ripTarget = targetInfo.target;
                break;
            }
        }
        return(hit);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 添加目标
    /// </summary>
    public void AddTarget(GameObject go, float radius)
    {
        RipTargetInfo info = null;

        for (int i = 0; i < targetList.Count; i++)
        {
            if (targetList[i].target == go)
            {
                info = targetList[i];
                break;
            }
        }
        if (info == null)
        {
            info        = new RipTargetInfo();
            info.target = go;
            targetList.Add(info);
        }
        info.radius = radius;
    }