コード例 #1
0
 private void OnChangeMode(Session.CoreModes mode)
 {
     iceMode = mode == Session.CoreModes.Cold;
     if (ReverseCoreMode)
     {
         iceMode = !iceMode;
     }
     loopSfx.Param("room_state", iceMode ? 1 : 0);
 }
コード例 #2
0
        private void swapTexture(Session.CoreModes target)
        {
            string          spikeType     = target == Session.CoreModes.Cold ? coldType : hotType;
            string          direction     = Direction.ToString().ToLower();
            List <MTexture> spikeTextures = GFX.Game.GetAtlasSubtextures("danger/spikes/" + spikeType + "_" + direction);

            // be sure to use the same seed to pick the same spike indices when switching.
            Calc.PushRandom(randomSeed);
            foreach (Image image in Components.GetAll <Image>())
            {
                image.Texture = Calc.Random.Choose(spikeTextures);
            }
            Calc.PopRandom();
        }
コード例 #3
0
ファイル: Session.cs プロジェクト: david-reborn/Celeste
 public Session(AreaKey area, string checkpoint = null, AreaStats oldStats = null)
     : this()
 {
     this.Area            = area;
     this.StartCheckpoint = checkpoint;
     this.ColorGrade      = this.MapData.Data.ColorGrade;
     this.Dreaming        = AreaData.Areas[area.ID].Dreaming;
     //this.Inventory = AreaData.GetCheckpointInventory(area, checkpoint);
     this.CoreMode   = AreaData.Areas[area.ID].CoreMode;
     this.FirstLevel = true;
     //this.Audio = this.MapData.ModeData.AudioState.Clone();
     if (this.StartCheckpoint == null)
     {
         this.Level = this.MapData.StartLevel().Name;
         this.StartedFromBeginning = true;
     }
     else
     {
         this.Level = this.StartCheckpoint;
         this.StartedFromBeginning = false;
         this.Dreaming             = AreaData.GetCheckpointDreaming(area, checkpoint);
         this.CoreMode             = AreaData.GetCheckpointCoreMode(area, checkpoint);
         //AudioState checkpointAudioState = AreaData.GetCheckpointAudioState(area, checkpoint);
         //if (checkpointAudioState != null)
         //{
         //    if (checkpointAudioState.Music != null)
         //        this.Audio.Music = checkpointAudioState.Music.Clone();
         //    if (checkpointAudioState.Ambience != null)
         //        this.Audio.Ambience = checkpointAudioState.Ambience.Clone();
         //}
         string checkpointColorGrading = AreaData.GetCheckpointColorGrading(area, checkpoint);
         if (checkpointColorGrading != null)
         {
             this.ColorGrade = checkpointColorGrading;
         }
         CheckpointData checkpoint1 = AreaData.GetCheckpoint(area, checkpoint);
         if (checkpoint1 != null && checkpoint1.Flags != null)
         {
             foreach (string flag in checkpoint1.Flags)
             {
                 this.SetFlag(flag, true);
             }
         }
     }
     //if (oldStats != null)
     //    this.OldStats = oldStats;
     //else
     //    this.OldStats = SaveData.Instance.Areas[this.Area.ID].Clone();
 }
コード例 #4
0
ファイル: CoreBerry.cs プロジェクト: JaThePlayer/FrostHelper
 private void OnChangeMode(Session.CoreModes mode)
 {
     if (!IsIce)
     {
         // berry hot
         if (mode == Session.CoreModes.Cold)
         {
             Dissolve();
             sprite.Visible    = false;
             indicator.Visible = true;
         }
     }
     else
     {
         // berry cold
         if (mode == Session.CoreModes.Hot || mode == Session.CoreModes.None)
         {
             Dissolve();
             sprite.Visible    = false;
             indicator.Visible = true;
         }
     }
 }
コード例 #5
0
 private void OnChangeMode(Session.CoreModes mode)
 {
     iceMode = (mode == Session.CoreModes.Cold);
     loopSfx.Param("room_state", iceMode ? 1 : 0);
 }
コード例 #6
0
ファイル: CoreModeTrigger.cs プロジェクト: reimoe/Everest
 public CoreModeTrigger(EntityData data, Vector2 offset) : base(data, offset)
 {
     mode = data.Enum("mode", Session.CoreModes.None);
 }
コード例 #7
0
        public void Read(BinaryReader reader)
        {
            InSession = reader.ReadBoolean();
            if (!InSession)
            {
                return;
            }

            byte bools;
            int  count;

            if (reader.ReadBoolean())
            {
                ChunkEAudioState audio = new ChunkEAudioState();
                audio.Read(reader);
                Audio = audio.Audio;
            }

            if (reader.ReadBoolean())
            {
                RespawnPoint = new Vector2(reader.ReadSingle(), reader.ReadSingle());
            }

            Inventory           = new PlayerInventory();
            bools               = reader.ReadByte();
            Inventory.Backpack  = UnpackBool(bools, 0);
            Inventory.DreamDash = UnpackBool(bools, 1);
            Inventory.NoRefills = UnpackBool(bools, 2);
            Inventory.Dashes    = reader.ReadByte();

            Flags = new HashSet <string>();
            count = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                Flags.Add(reader.ReadNullTerminatedString());
            }

            LevelFlags = new HashSet <string>();
            count      = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                LevelFlags.Add(reader.ReadNullTerminatedString());
            }

            Strawberries = new HashSet <EntityID>();
            count        = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                Strawberries.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32()));
            }

            DoNotLoad = new HashSet <EntityID>();
            count     = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                DoNotLoad.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32()));
            }

            Keys  = new HashSet <EntityID>();
            count = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                Keys.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32()));
            }

            Counters = new List <Session.Counter>();
            count    = reader.ReadByte();
            for (int i = 0; i < count; i++)
            {
                Counters.Add(new Session.Counter {
                    Key   = reader.ReadNullTerminatedString(),
                    Value = reader.ReadInt32()
                });
            }

            FurthestSeenLevel = reader.ReadNullTerminatedString()?.Nullify();
            StartCheckpoint   = reader.ReadNullTerminatedString()?.Nullify();
            ColorGrade        = reader.ReadNullTerminatedString()?.Nullify();

            count      = reader.ReadByte();
            SummitGems = new bool[count];
            for (int i = 0; i < count; i++)
            {
                if ((i % 8) == 0)
                {
                    bools = reader.ReadByte();
                }
                SummitGems[i] = UnpackBool(bools, i % 8);
            }

            bools         = reader.ReadByte();
            FirstLevel    = UnpackBool(bools, 0);
            Cassette      = UnpackBool(bools, 1);
            HeartGem      = UnpackBool(bools, 2);
            Dreaming      = UnpackBool(bools, 3);
            GrabbedGolden = UnpackBool(bools, 4);
            HitCheckpoint = UnpackBool(bools, 5);

            LightingAlphaAdd = reader.ReadSingle();
            BloomBaseAdd     = reader.ReadSingle();
            DarkRoomAlpha    = reader.ReadSingle();

            Time = reader.ReadInt64();

            CoreMode = (Session.CoreModes)reader.ReadByte();
        }
コード例 #8
0
 private void OnChangeMode(Session.CoreModes coreMode)
 {
     fireMode           = false;
     spriteEvil.Visible = fireMode;
     sprite.Visible     = !fireMode;
 }
コード例 #9
0
        public void OnCoreMode(Session.CoreModes mode)
        {
            // Skip updating when the new mode is cold and the previous is none, because they have the same sprites
            if (CoreMode == Session.CoreModes.None && mode == Session.CoreModes.Cold)
            {
                CoreMode = mode;
                return;
            }

            CoreMode = mode;

            // Change the face and the particles
            if (CoreMode == Session.CoreModes.Hot)
            {
                Face.Visible      = false;
                AngryFace.Visible = true;
                P_Activate        = P_HotActivate;
                P_Crushing        = P_HotCrushing;
            }
            else
            {
                Face.Visible      = true;
                AngryFace.Visible = false;
                P_Activate        = P_ColdActivate;
                P_Crushing        = P_ColdCrushing;
            }

            // Change the "lit" images
            if (CoreMode == Session.CoreModes.Hot)
            {
                CoreKevinHook.CurrentLeftPath   = "objects/nyahhelper/corekevin/lit_left";
                CoreKevinHook.CurrentRightPath  = "objects/nyahhelper/corekevin/lit_right";
                CoreKevinHook.CurrentTopPath    = "objects/nyahhelper/corekevin/lit_top";
                CoreKevinHook.CurrentBottomPath = "objects/nyahhelper/corekevin/lit_bottom";
            }
            else
            {
                CoreKevinHook.CurrentLeftPath   = "objects/crushblock/lit_left";
                CoreKevinHook.CurrentRightPath  = "objects/crushblock/lit_right";
                CoreKevinHook.CurrentTopPath    = "objects/crushblock/lit_top";
                CoreKevinHook.CurrentBottomPath = "objects/crushblock/lit_bottom";
            }


            #region Decompiled block images generator
            List <MTexture> atlasSubtextures = GFX.Game.GetAtlasSubtextures(BlockPath);

            switch (Mode)
            {
            default:
                Idle     = atlasSubtextures[3];
                CanMoveH = (CanMoveV = true);
                break;

            case Axes.Horizontal:
                Idle     = atlasSubtextures[1];
                CanMoveH = true;
                CanMoveV = false;
                break;

            case Axes.Vertical:
                Idle     = atlasSubtextures[2];
                CanMoveH = false;
                CanMoveV = true;
                break;
            }

            // Remove all images, not decompiled
            new List <Image>(Components.GetAll <Image>()).ForEach((img) => { if (img != null && img.GetType() == typeof(Image))
                                                                             {
                                                                                 Remove(img);
                                                                             }
                                                                  });

            int num  = (int)(Width / 8f) - 1;
            int num2 = (int)(Height / 8f) - 1;
            AddImage(Idle, 0, 0, 0, 0, -1, -1);
            AddImage(Idle, num, 0, 3, 0, 1, -1);
            AddImage(Idle, 0, num2, 0, 3, -1, 1);
            AddImage(Idle, num, num2, 3, 3, 1, 1);
            for (int i = 1; i < num; i++)
            {
                AddImage(Idle, i, 0, Calc.Random.Choose(1, 2), 0, 0, -1);
                AddImage(Idle, i, num2, Calc.Random.Choose(1, 2), 3, 0, 1);
            }
            for (int j = 1; j < num2; j++)
            {
                AddImage(Idle, 0, j, 0, Calc.Random.Choose(1, 2), -1, 0);
                AddImage(Idle, num, j, 3, Calc.Random.Choose(1, 2), 1, 0);
            }
            #endregion
        }
コード例 #10
0
 private void OnChangeMode(Session.CoreModes coreMode)
 {
     iceModeNext = coreMode == Session.CoreModes.Cold;
 }
コード例 #11
0
        private static void CheckIceRoom(On.Celeste.CoreModeToggle.orig_OnChangeMode orig, CoreModeToggle self, Session.CoreModes mode)
        {
            orig(self, mode);
            var level = self.Scene as Level ?? throw new Exception("dude what");

            if (mode == Session.CoreModes.Cold && level.Session.Level == "b-04")
            {
                BingoClient.Instance.ModSaveData.AddFlag("first_ice");
            }
        }
コード例 #12
0
ファイル: CoreBerry.cs プロジェクト: JaThePlayer/FrostHelper
        public override void Added(Scene scene)
        {
            base.Added(scene);
            Remove(Get <BloomPoint>());
            string spr;
            string ind;

            if (IsIce)
            {
                ind = "collectables/FrostHelper/CoreBerry/Cold/CoreBerry_Cold_Indicator";
                if (SaveData.Instance.CheckStrawberry(ID))
                {
                    spr = "coldberryghost";
                }
                else
                {
                    spr = "coldberry";
                }
            }
            else
            {
                ind = "collectables/FrostHelper/CoreBerry/Hot/CoreBerry_Hot_Indicator";
                if (SaveData.Instance.CheckStrawberry(ID))
                {
                    spr = "hotberryghost";
                }
                else
                {
                    spr = "hotberry";
                }
            }
            DynData <Strawberry> data = new DynData <Strawberry>(this);

            sprite = data.Get <Sprite>("sprite");
            Remove(sprite);
            sprite = FrostHelper.FrostModule.SpriteBank.Create(spr);
            Add(sprite);
            data.Set("sprite", sprite);
            indicator = new Sprite(GFX.Game, ind);
            indicator.AddLoop("idle", "", 0.1f);
            indicator.Play("idle", false, false);
            indicator.CenterOrigin();
            indicator.Visible = false;
            Add(indicator);

            Level level = scene as Level;

            Session.CoreModes mode = level.Session.CoreMode;
            if (!IsIce)
            {
                // berry hot
                if (mode == Session.CoreModes.Cold)
                {
                    Dissolve(false);
                    sprite.Visible    = false;
                    indicator.Visible = true;
                }
            }
            else
            {
                // berry cold
                if (mode == Session.CoreModes.Hot || mode == Session.CoreModes.None)
                {
                    Dissolve(false);
                    sprite.Visible    = false;
                    indicator.Visible = true;
                }
            }
        }
コード例 #13
0
 private void onCoreModeChange(Session.CoreModes newCoreMode)
 {
     swapTexture(newCoreMode);
 }