Beispiel #1
0
        public static IEnumerable <LocalTargetInfo> TargetsAt(Vector3 clickPos, TargetingParameters clickParams, bool thingsOnly = false)
        {
            List <Thing> clickableList = GenUI.ThingsUnderMouse(clickPos, 0.8f, clickParams);
            int          i             = 0;

            if (i < clickableList.Count)
            {
                yield return((LocalTargetInfo)clickableList[i]);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (thingsOnly)
            {
                yield break;
            }
            IntVec3 cellTarg = UI.MouseCell();

            if (!cellTarg.InBounds(Find.VisibleMap))
            {
                yield break;
            }
            if (!clickParams.CanTarget(new TargetInfo(cellTarg, Find.VisibleMap, false)))
            {
                yield break;
            }
            yield return((LocalTargetInfo)cellTarg);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Beispiel #2
0
        public static IEnumerable <LocalTargetInfo> TargetsAt(Vector3 clickPos, TargetingParameters clickParams, bool thingsOnly = false)
        {
            List <Thing> clickableList = GenUI.ThingsUnderMouse(clickPos, 0.8f, clickParams);

            for (int i = 0; i < clickableList.Count; i++)
            {
                yield return(clickableList[i]);
            }
            if (!thingsOnly)
            {
                IntVec3 cellTarg = UI.MouseCell();
                if (cellTarg.InBounds(Find.VisibleMap) && clickParams.CanTarget(new TargetInfo(cellTarg, Find.VisibleMap, false)))
                {
                    yield return(cellTarg);
                }
            }
        }