Example #1
0
 public void ConstructComponents()
 {
     this.spawnedThings      = new ThingOwner <Thing>(this);
     this.cellIndices        = new CellIndices(this);
     this.listerThings       = new ListerThings(ListerThingsUse.Global);
     this.listerBuildings    = new ListerBuildings();
     this.mapPawns           = new MapPawns(this);
     this.dynamicDrawManager = new DynamicDrawManager(this);
     this.mapDrawer          = new MapDrawer(this);
     this.tooltipGiverList   = new TooltipGiverList();
     this.pawnDestinationReservationManager = new PawnDestinationReservationManager();
     this.reservationManager = new ReservationManager(this);
     this.physicalInteractionReservationManager = new PhysicalInteractionReservationManager();
     this.designationManager             = new DesignationManager(this);
     this.lordManager                    = new LordManager(this);
     this.debugDrawer                    = new DebugCellDrawer();
     this.passingShipManager             = new PassingShipManager(this);
     this.haulDestinationManager         = new HaulDestinationManager(this);
     this.gameConditionManager           = new GameConditionManager(this);
     this.weatherManager                 = new WeatherManager(this);
     this.zoneManager                    = new ZoneManager(this);
     this.resourceCounter                = new ResourceCounter(this);
     this.mapTemperature                 = new MapTemperature(this);
     this.temperatureCache               = new TemperatureCache(this);
     this.areaManager                    = new AreaManager(this);
     this.attackTargetsCache             = new AttackTargetsCache(this);
     this.attackTargetReservationManager = new AttackTargetReservationManager(this);
     this.lordsStarter                   = new VoluntarilyJoinableLordsStarter(this);
     this.thingGrid                  = new ThingGrid(this);
     this.coverGrid                  = new CoverGrid(this);
     this.edificeGrid                = new EdificeGrid(this);
     this.blueprintGrid              = new BlueprintGrid(this);
     this.fogGrid                    = new FogGrid(this);
     this.glowGrid                   = new GlowGrid(this);
     this.regionGrid                 = new RegionGrid(this);
     this.terrainGrid                = new TerrainGrid(this);
     this.pathGrid                   = new PathGrid(this);
     this.roofGrid                   = new RoofGrid(this);
     this.fertilityGrid              = new FertilityGrid(this);
     this.snowGrid                   = new SnowGrid(this);
     this.deepResourceGrid           = new DeepResourceGrid(this);
     this.exitMapGrid                = new ExitMapGrid(this);
     this.linkGrid                   = new LinkGrid(this);
     this.glowFlooder                = new GlowFlooder(this);
     this.powerNetManager            = new PowerNetManager(this);
     this.powerNetGrid               = new PowerNetGrid(this);
     this.regionMaker                = new RegionMaker(this);
     this.pathFinder                 = new PathFinder(this);
     this.pawnPathPool               = new PawnPathPool(this);
     this.regionAndRoomUpdater       = new RegionAndRoomUpdater(this);
     this.regionLinkDatabase         = new RegionLinkDatabase();
     this.moteCounter                = new MoteCounter();
     this.gatherSpotLister           = new GatherSpotLister();
     this.windManager                = new WindManager(this);
     this.listerBuildingsRepairable  = new ListerBuildingsRepairable();
     this.listerHaulables            = new ListerHaulables(this);
     this.listerMergeables           = new ListerMergeables(this);
     this.listerFilthInHomeArea      = new ListerFilthInHomeArea(this);
     this.reachability               = new Reachability(this);
     this.itemAvailability           = new ItemAvailability(this);
     this.autoBuildRoofAreaSetter    = new AutoBuildRoofAreaSetter(this);
     this.roofCollapseBufferResolver = new RoofCollapseBufferResolver(this);
     this.roofCollapseBuffer         = new RoofCollapseBuffer();
     this.wildAnimalSpawner          = new WildAnimalSpawner(this);
     this.wildPlantSpawner           = new WildPlantSpawner(this);
     this.steadyEnvironmentEffects   = new SteadyEnvironmentEffects(this);
     this.skyManager                 = new SkyManager(this);
     this.overlayDrawer              = new OverlayDrawer();
     this.floodFiller                = new FloodFiller(this);
     this.weatherDecider             = new WeatherDecider(this);
     this.fireWatcher                = new FireWatcher(this);
     this.dangerWatcher              = new DangerWatcher(this);
     this.damageWatcher              = new DamageWatcher();
     this.strengthWatcher            = new StrengthWatcher(this);
     this.wealthWatcher              = new WealthWatcher(this);
     this.regionDirtyer              = new RegionDirtyer(this);
     this.cellsInRandomOrder         = new MapCellsInRandomOrder(this);
     this.rememberedCameraPos        = new RememberedCameraPos(this);
     this.mineStrikeManager          = new MineStrikeManager();
     this.storyState                 = new StoryState(this);
     this.retainedCaravanData        = new RetainedCaravanData(this);
     this.components.Clear();
     this.FillComponents();
 }
Example #2
0
        public void Update()
        {
            if (LongEventHandler.ShouldWaitForEvent)
            {
                if (Current.SubcameraDriver != null)
                {
                    Current.SubcameraDriver.UpdatePositions(this.MyCamera);
                }
                return;
            }
            if (Find.VisibleMap == null)
            {
                return;
            }
            Vector2 lhs = this.CalculateCurInputDollyVect();

            if (lhs != Vector2.zero)
            {
                float d = (this.rootSize - 11f) / 49f * 0.7f + 0.3f;
                this.velocity = new Vector3(lhs.x, 0f, lhs.y) * d;
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraDolly, KnowledgeAmount.FrameInteraction);
            }
            if (!this.AnythingPreventsCameraMotion)
            {
                float d2 = Time.deltaTime * CameraDriver.HitchReduceFactor;
                this.rootPos += this.velocity * d2 * this.config.moveSpeedScale;
                if (this.rootPos.x > (float)Find.VisibleMap.Size.x + -2f)
                {
                    this.rootPos.x = (float)Find.VisibleMap.Size.x + -2f;
                }
                if (this.rootPos.z > (float)Find.VisibleMap.Size.z + -2f)
                {
                    this.rootPos.z = (float)Find.VisibleMap.Size.z + -2f;
                }
                if (this.rootPos.x < 2f)
                {
                    this.rootPos.x = 2f;
                }
                if (this.rootPos.z < 2f)
                {
                    this.rootPos.z = 2f;
                }
            }
            if (this.velocity != Vector3.zero)
            {
                this.velocity *= this.config.camSpeedDecayFactor;
                if (this.velocity.magnitude < 0.1f)
                {
                    this.velocity = Vector3.zero;
                }
            }
            float num = this.desiredSize - this.rootSize;

            this.rootSize += num * 0.4f;
            this.shaker.Update();
            this.ApplyPositionToGameObject();
            Current.SubcameraDriver.UpdatePositions(this.MyCamera);
            if (Find.VisibleMap != null)
            {
                RememberedCameraPos rememberedCameraPos = Find.VisibleMap.rememberedCameraPos;
                rememberedCameraPos.rootPos  = this.rootPos;
                rememberedCameraPos.rootSize = this.rootSize;
            }
        }
Example #3
0
        public void Update()
        {
            if (LongEventHandler.ShouldWaitForEvent)
            {
                if (Current.SubcameraDriver != null)
                {
                    Current.SubcameraDriver.UpdatePositions(this.MyCamera);
                }
                return;
            }
            if (Find.CurrentMap == null)
            {
                return;
            }
            Vector2 lhs = this.CalculateCurInputDollyVect();

            if (lhs != Vector2.zero)
            {
                float d = (this.rootSize - 11f) / 49f * 0.7f + 0.3f;
                this.velocity = new Vector3(lhs.x, 0f, lhs.y) * d;
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraDolly, KnowledgeAmount.FrameInteraction);
            }
            if (!this.AnythingPreventsCameraMotion)
            {
                float d2 = Time.deltaTime * CameraDriver.HitchReduceFactor;
                this.rootPos  += this.velocity * d2 * this.config.moveSpeedScale;
                this.rootPos.x = Mathf.Clamp(this.rootPos.x, 2f, (float)Find.CurrentMap.Size.x + -2f);
                this.rootPos.z = Mathf.Clamp(this.rootPos.z, 2f, (float)Find.CurrentMap.Size.z + -2f);
            }
            int num = Gen.FixedTimeStepUpdate(ref this.fixedTimeStepBuffer, 60f);

            for (int i = 0; i < num; i++)
            {
                if (this.velocity != Vector3.zero)
                {
                    this.velocity *= this.config.camSpeedDecayFactor;
                    if (this.velocity.magnitude < 0.1f)
                    {
                        this.velocity = Vector3.zero;
                    }
                }
                if (this.config.smoothZoom)
                {
                    float num2 = Mathf.Lerp(this.rootSize, this.desiredSize, 0.05f);
                    this.desiredSize += (num2 - this.rootSize) * this.config.zoomPreserveFactor;
                    this.rootSize     = num2;
                }
                else
                {
                    float num3 = this.desiredSize - this.rootSize;
                    float num4 = num3 * 0.4f;
                    this.desiredSize += this.config.zoomPreserveFactor * num4;
                    this.rootSize    += num4;
                }
                this.config.ConfigFixedUpdate_60(ref this.velocity);
            }
            this.shaker.Update();
            this.ApplyPositionToGameObject();
            Current.SubcameraDriver.UpdatePositions(this.MyCamera);
            if (Find.CurrentMap != null)
            {
                RememberedCameraPos rememberedCameraPos = Find.CurrentMap.rememberedCameraPos;
                rememberedCameraPos.rootPos  = this.rootPos;
                rememberedCameraPos.rootSize = this.rootSize;
            }
        }
Example #4
0
 public void Update()
 {
     if (LongEventHandler.ShouldWaitForEvent)
     {
         if (Current.SubcameraDriver != null)
         {
             Current.SubcameraDriver.UpdatePositions(MyCamera);
         }
     }
     else
     {
         if (Find.CurrentMap == null)
         {
             return;
         }
         Vector2 lhs = CalculateCurInputDollyVect();
         if (lhs != Vector2.zero)
         {
             float d = (rootSize - config.minSize) / (60f - config.minSize) * 0.7f + 0.3f;
             velocity = new Vector3(lhs.x, 0f, lhs.y) * d;
             PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.CameraDolly, KnowledgeAmount.FrameInteraction);
         }
         if (!Input.GetMouseButton(2) && dragTimeStamps.Any())
         {
             Vector2 extraVelocityFromReleasingDragButton = GetExtraVelocityFromReleasingDragButton(dragTimeStamps, 0.75f);
             velocity += new Vector3(extraVelocityFromReleasingDragButton.x, 0f, extraVelocityFromReleasingDragButton.y);
             dragTimeStamps.Clear();
         }
         if (!AnythingPreventsCameraMotion)
         {
             float d2 = Time.deltaTime * HitchReduceFactor;
             rootPos += velocity * d2 * config.moveSpeedScale;
             rootPos += new Vector3(desiredDollyRaw.x, 0f, desiredDollyRaw.y);
             dragTimeStamps.Add(new DragTimeStamp
             {
                 posDelta = desiredDollyRaw,
                 time     = Time.time
             });
             rootPos.x = Mathf.Clamp(rootPos.x, 2f, (float)Find.CurrentMap.Size.x + -2f);
             rootPos.z = Mathf.Clamp(rootPos.z, 2f, (float)Find.CurrentMap.Size.z + -2f);
         }
         desiredDollyRaw = Vector2.zero;
         int num = Gen.FixedTimeStepUpdate(ref fixedTimeStepBuffer, 60f);
         for (int i = 0; i < num; i++)
         {
             if (velocity != Vector3.zero)
             {
                 velocity *= config.camSpeedDecayFactor;
                 if (velocity.magnitude < 0.1f)
                 {
                     velocity = Vector3.zero;
                 }
             }
             if (config.smoothZoom)
             {
                 float num2 = Mathf.Lerp(rootSize, desiredSize, 0.05f);
                 desiredSize += (num2 - rootSize) * config.zoomPreserveFactor;
                 rootSize     = num2;
             }
             else
             {
                 float num3 = (desiredSize - rootSize) * 0.4f;
                 desiredSize += config.zoomPreserveFactor * num3;
                 rootSize    += num3;
             }
             config.ConfigFixedUpdate_60(ref velocity);
         }
         shaker.Update();
         ApplyPositionToGameObject();
         Current.SubcameraDriver.UpdatePositions(MyCamera);
         if (Find.CurrentMap != null)
         {
             RememberedCameraPos rememberedCameraPos = Find.CurrentMap.rememberedCameraPos;
             rememberedCameraPos.rootPos  = rootPos;
             rememberedCameraPos.rootSize = rootSize;
         }
     }
 }