예제 #1
0
        internal static void LoadState(
            List <RestrictLink> links, List <Pawn> pawns, Policy policy)
        {
            List <RestrictLink> mapLinks  = null;
            List <RestrictLink> zoneLinks = null;
            int currentMap = Find.CurrentMap.uniqueID;

            //get all links from the current map
            mapLinks = links.FindAll(x => x.mapId == currentMap);
            //get all links from the selected zone
            zoneLinks = mapLinks.FindAll(x => x.zone == policy.id);

            foreach (Pawn p in pawns)
            {
                foreach (RestrictLink l in zoneLinks)
                {
                    if (l.colonist != null && l.colonist.Equals(p))
                    {
                        p.playerSettings.AreaRestriction = l.area;
                        RestrictManager.CopySchedule(l.schedule, p.timetable.times);
                    }
                }
            }

            RestrictManager.SetActivePolicy(policy);
        }
        private static void UpdateState(
            List <RestrictLink> links, List <Pawn> pawns, Policy policy)
        {
            List <RestrictLink> mapLinks  = null;
            List <RestrictLink> zoneLinks = null;
            int currentMap = Find.VisibleMap.uniqueID;

            //get all links from the current map
            mapLinks = links.FindAll(x => x.mapId == currentMap);
            //get all links from the selected zone
            zoneLinks = mapLinks.FindAll(x => x.zone == policy.id);

            foreach (Pawn p in pawns)
            {
                foreach (RestrictLink l in zoneLinks)
                {
                    if (l.colonist != null && l.colonist.Equals(p))
                    {
                        l.area = p.playerSettings.AreaRestriction;
                    }
                }
            }

            RestrictManager.SetActivePolicy(policy);
        }