예제 #1
0
    private void StartWickSustainer()
    {
        SoundStarter.PlayOneShot(CompExplosiveNuke.PreImpact, (SoundInfo)this.parent.Position);
        SoundInfo info = SoundInfo.InWorld((TargetInfo)((Thing)this.parent), MaintenanceType.PerTick);

        this.wickSoundSustainer = SoundStarter.TrySpawnSustainer(CompExplosiveNuke.Null, info);
    }
예제 #2
0
        public virtual void StartMusic(TuneDef parmDef = null)
        {
            if (state == State.off)
            {
                state = State.on;
            }

            //Establish duration
            //Cthulhu.Utility.DebugReport("Cur Time:" + Time.time.ToString());
            duration = Time.time + currentTuneDef.durationTime;
            //Cthulhu.Utility.DebugReport(currentTuneDef.ToString() + " Fin Time:" + duration.ToString());

            //Clear old song
            this.playingSong = null;

            //Put on new song
            SoundInfo soundInfo = SoundInfo.InMap(this, MaintenanceType.None);
            SoundDef  soundDef  = currentTuneDef as SoundDef;

            if (parmDef != null)
            {
                soundDef = parmDef as SoundDef;
            }
            this.playingSong = SoundStarter.TrySpawnSustainer(soundDef, soundInfo);
        }
예제 #3
0
        private void StartSpray()
        {
            SnowUtility.AddSnowRadial(this.OccupiedRect().RandomCell, Map, 4, -0.06f);

            spraySustainer          = SoundStarter.TrySpawnSustainer(SoundDefOf.GeyserSpray, new TargetInfo(Position, Map));
            spraySustainerStartTick = Find.TickManager.TicksGame;
        }
예제 #4
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            //Before base.SpawnSetup() so when regions are rebuilt this building can be accessed via edificeGrid
            if (def.IsEdifice())
            {
                map.edificeGrid.Register(this);
            }

            base.SpawnSetup(map, respawningAfterLoad);

            Map.listerBuildings.Add(this);

            //Remake terrain meshes with new underwall under me
            if (def.coversFloor)
            {
                Map.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Terrain, true, false);
            }

            var occRect = this.OccupiedRect();

            for (int z = occRect.minZ; z <= occRect.maxZ; z++)
            {
                for (int x = occRect.minX; x <= occRect.maxX; x++)
                {
                    var c = new IntVec3(x, 0, z);
                    Map.mapDrawer.MapMeshDirty(c, MapMeshFlag.Buildings);
                    Map.glowGrid.MarkGlowGridDirty(c);
                    if (!SnowGrid.CanCoexistWithSnow(def))
                    {
                        Map.snowGrid.SetDepth(c, 0);
                    }
                }
            }

            if (Faction == Faction.OfPlayer)
            {
                if (def.building != null && def.building.spawnedConceptLearnOpportunity != null)
                {
                    LessonAutoActivator.TeachOpportunity(def.building.spawnedConceptLearnOpportunity, OpportunityType.GoodToKnow);
                }
            }

            AutoHomeAreaMaker.Notify_BuildingSpawned(this);

            if (def.building != null && !def.building.soundAmbient.NullOrUndefined())
            {
                LongEventHandler.ExecuteWhenFinished(() =>
                {
                    SoundInfo info   = SoundInfo.InMap(this, MaintenanceType.None);
                    sustainerAmbient = SoundStarter.TrySpawnSustainer(def.building.soundAmbient, info);
                });
            }

            Map.listerBuildingsRepairable.Notify_BuildingSpawned(this);

            if (!this.CanBeSeenOver())
            {
                Map.exitMapGrid.Notify_LOSBlockerSpawned();
            }

            SmoothSurfaceDesignatorUtility.Notify_BuildingSpawned(this);

            //Must go after adding to buildings list
            map.avoidGrid.Notify_BuildingSpawned(this);
        }