Пример #1
0
        private static bool lineIsFree(Level level, IntVec start, IntVec end, bool solidCharacters = true)
        {
            bool result = true;

            foreach (IntVec vec in lineBetween(level, start, end))
            {
                if (result && !vec.Equals(end) && level.isSolid(vec) && (solidCharacters || level.CharacterEntities.FindEntity(vec) == null))
                {
                    result = false;
                }
            }

            return(result);
        }
Пример #2
0
        public static IntVec[] getTargetLine(Level level, IntVec start, IntVec end, bool solidCharacters = true)
        {
            List <IntVec> positions = new List <IntVec>();

            bool stillAdding = true;

            foreach (IntVec vec in lineBetween(level, start, end))
            {
                if (stillAdding)
                {
                    if (level.isSolid(vec) && (solidCharacters || level.CharacterEntities.FindEntity(vec) == null))
                    {
                        stillAdding = false;
                    }
                    else
                    {
                        positions.Add(vec);
                    }
                }
            }

            return(positions.ToArray <IntVec>());
        }