Exemple #1
0
        //获得指定范围的物品(仅供父级场景调用)
        public Item[] GetRangeItems(AStarRange range, string belong = null, bool isNotIncludeChildScene = false)
        {
            List <Item> result = new List <Item>();
            var         items  = GetItems(null, belong, isNotIncludeChildScene);

            for (var i = 0; i < items.Length; i++)
            {
                var        item = items[i];
                Vector2Int pos  = item.GetEnv <Scene>().ToParentPos(item.GetPos(), this);
                if (range.IsInRange(pos))
                {
                    result.Add(item);
                }
            }

            return(result.ToArray());
        }
Exemple #2
0
        //获得指定范围的子场景(仅供父级场景调用)
        public Scene[] GetRangeScenes(AStarRange range, string belong)
        {
            CheckParentCall();

            List <Scene> list   = new List <Scene>();
            var          scenes = GetChildScenes(null, belong);

            for (var i = 0; i < scenes.Length; i++)
            {
                Scene childScene = scenes[i];
                if (range.IsInRange(childScene.GetPos()))
                {
                    list.Add(childScene);
                }
            }

            return(list.ToArray());
        }