Ejemplo n.º 1
0
        private List <Data.Cord> GetPosibleCords(Space.Room room, Data.Side target, bool is_simple)
        {
            List <Data.Cord> avalCords = new List <Data.Cord>();

            Data.Cord start = new Data.Cord();
            Data.Cord end   = new Data.Cord();
            switch (target.Position)
            {
            case Data.SideCardinalDirection.West:
                start = new Data.Cord(target.Start, -room.Size.Length, 0, 0);
                end   = new Data.Cord(target.End, -room.Size.Length, -room.Size.Width, 0);
                break;

            case Data.SideCardinalDirection.North:
                start = new Data.Cord(target.Start, 0, 0, 0);
                end   = new Data.Cord(target.End, -room.Size.Length, 0, 0);

                break;

            case Data.SideCardinalDirection.East:
                start = new Data.Cord(target.Start, 0, 0, 0);
                end   = new Data.Cord(target.End, 0, -room.Size.Width, 0);
                break;

            case Data.SideCardinalDirection.South:
                start = new Data.Cord(target.Start, 0, -room.Size.Width, 0);
                end   = new Data.Cord(target.End, -room.Size.Length, -room.Size.Width, 0);
                break;
            }
            avalCords.Add(start);
            avalCords.Add(end);
            if (!is_simple)
            {
                Data.Cord last = this.GetPosibleCord(avalCords, new Data.Side(target.Position, target.Type, start, end), Data.Config.MinimalOverlap);
                if (last != null)
                {
                    avalCords.Add(last);
                }
            }
            return(avalCords);
        }
Ejemplo n.º 2
0
        //id는 입력된 Side가 소속된 공간
        private bool IsOutterSide(Guid id, Data.Side side, Space.RelationLevel level)
        {
            foreach (Space.RoomRelationShip other in this.Relations[level])
            {
                if (id != other.Origin.id)
                {
                    foreach (Data.SideCardinalDirection othersideDirection in Enum.GetValues(typeof(Data.SideCardinalDirection)))
                    {
                        foreach (Data.Side otherSide in other.Origin.Sides[othersideDirection])
                        {
                            if (side.IsContact(otherSide))
                            {
                                return(false);
                            }
                        }
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        private Data.Cord GetPosibleCord(List <Data.Cord> collect, Data.Side side, double length)
        {
            if (side.GetLength() < length)
            {
                return(null);
            }

            Data.Cord mid = side.GetMidCord();

            Data.Cord before = GetPosibleCord(collect, new Data.Side(side.Position, side.Type, side.Start, mid), length);
            if (before != null)
            {
                collect.Add(before);
            }
            Data.Cord after = GetPosibleCord(collect, new Data.Side(side.Position, side.Type, mid, side.End), length);
            if (after != null)
            {
                collect.Add(after);
            }

            return(mid);
        }