示例#1
0
            ClimbNeighbor[] UpdateAllNeighbors(Transform curTarget)
            {
                List <ClimbNeighbor> retVal = new List <ClimbNeighbor>();

                foreach (Transform childObj in targetObject.transform)
                {
                    foreach (Transform climbObj in childObj.Find("ClimbPoints").transform)
                    {
                        if (curTarget == climbObj)
                        {
                            continue;
                        }
                        else if (Vector3.Distance(curTarget.position, climbObj.position) <= distance)
                        {
                            ClimbNeighbor foundPoint = new ClimbNeighbor();
                            foundPoint.target    = climbObj.GetComponentInChildren <ClimbPoint>();
                            foundPoint.type      = ClimbTransitionType.step;
                            foundPoint.direction = GetClimbDirection(climbObj, curTarget);
                            retVal.Add(foundPoint);
                        }
                    }
                }
//                foreach(Transform child in curTarget) {
//                    if (curTarget == child)
//                        continue;
//                    if (Vector3.Distance (curTarget.position, child.position) <= distance) {
//                        ClimbNeighbor foundPoint = new ClimbNeighbor ();
//                        foundPoint.target = child.GetComponentInChildren<ClimbPoint>();
//                        foundPoint.type = ClimbTransitionType.step;
//                        foundPoint.direction = GetClimbDirection(child, curTarget);
//                        retVal.Add (foundPoint);
//                    }
//                }
                return(retVal.ToArray());
            }
示例#2
0
            ClimbNeighbor[] FindAllNeighbors(Transform curTarget)
            {
                List <ClimbNeighbor> retVal = new List <ClimbNeighbor>();

                foreach (Transform child in targetObject.transform.Find("ClimbPoints").transform)
                {
                    if (curTarget == child)
                    {
                        continue;
                    }
                    if (Vector3.Distance(curTarget.position, child.position) <= distance)
                    {
                        ClimbNeighbor foundPoint = new ClimbNeighbor();
                        foundPoint.target    = child.GetComponentInChildren <ClimbPoint>();
                        foundPoint.type      = ClimbTransitionType.step;
                        foundPoint.direction = GetClimbDirection(child, curTarget);
                        retVal.Add(foundPoint);
                    }
                }
                return(retVal.ToArray());
            }