Пример #1
0
    public GameObject GetNavi(GameObject fromObj, UINaviNodeRelation relation)
    {
        GameObject toObj    = null;
        UINaviNode naviNode = GetActiveNaviNode(fromObj);

        switch (relation)
        {
        case UINaviNodeRelation.Left:
            toObj = naviNode.leftObj;
            break;

        case UINaviNodeRelation.Right:
            toObj = naviNode.rightObj;
            break;

        case UINaviNodeRelation.Up:
            toObj = naviNode.upObj;
            break;

        case UINaviNodeRelation.Down:
            toObj = naviNode.downObj;
            break;
        }
        return(toObj);
    }
Пример #2
0
    /// <summary>
    /// 添加一个导航信息
    /// </summary>
    public void AddNavi(GameObject fromObj, GameObject toObj, UINaviNodeRelation relation)
    {
        if (fromObj == null || toObj == null)
        {
            return;
        }

        UINaviNode naviNode = GetActiveNaviNode(fromObj);

        switch (relation)
        {
        case UINaviNodeRelation.Left:
            naviNode.leftObj = toObj;
            break;

        case UINaviNodeRelation.Right:
            naviNode.rightObj = toObj;
            break;

        case UINaviNodeRelation.Up:
            naviNode.upObj = toObj;
            break;

        case UINaviNodeRelation.Down:
            naviNode.downObj = toObj;
            break;
        }
    }