public TrackSwitchBox(Vector2 position, bool global, bool canFloat, bool canBounce) : base(position, 32f, 32f, safe: true) { colorLerp = (LocalTrackSwitchState = CommunalHelperModule.Session.TrackInitialState) == TrackSwitchState.On ? 0f : 1f; this.global = global; this.canFloat = canFloat; this.canBounce = canBounce; SurfaceSoundIndex = SurfaceIndex.ZipMover; start = Position; sprite = CommunalHelperModule.SpriteBank.Create("trackSwitchBox"); sprite.Position = new Vector2(Width, Height) / 2f; sprite.OnLastFrame = anim => { if (anim == "switch") { canSwitch = true; } }; Add(Sfx = new SoundSource() { Position = new Vector2(Width / 2, Height / 2) }); Add(sprite); Add(sine = new SineWave(0.5f, 0f)); bounce = Wiggler.Create(1f, 0.5f); bounce.StartZero = false; Add(bounce); Add(shaker = new Shaker(on: false)); OnDashCollide = Dashed; }
private void SetCrystalHeartSprite(On.Celeste.HeartGem.orig_Awake orig, HeartGem self, Scene scene) { orig(self, scene); if (!self.IsGhost && !self.IsFake) { var meta = GetModeMetaForAltSide(AreaData.Get((scene as Level).Session.Area)); if (meta != null) { var selfdata = new DynData <HeartGem>(self); var sprite = new Sprite(GFX.Game, meta.InWorldHeartIcon); sprite.CenterOrigin(); sprite.AddLoop("idle", "", 0, new int[] { 0 }); sprite.AddLoop("spin", "", 0.1f, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); sprite.AddLoop("fastspin", "", 0.1f); sprite.CenterOrigin(); sprite.OnLoop = delegate(string anim) { if (self.Visible && anim == "spin" && (bool)selfdata["autoPulse"]) { Audio.Play("event:/game/general/crystalheart_pulse", self.Position); self.ScaleWiggler.Start(); (scene as Level).Displacement.AddBurst(self.Position, 0.35f, 8f, 48f, 0.25f); } }; sprite.Play("spin"); self.ScaleWiggler.RemoveSelf(); self.ScaleWiggler = Wiggler.Create(0.5f, 4f, delegate(float f) { sprite.Scale = Vector2.One * (1f + f * 0.25f); }); self.Add(self.ScaleWiggler); ((Component)selfdata["sprite"]).RemoveSelf(); selfdata["sprite"] = sprite; self.Add(sprite); } } }
public HeartGemShard(HeartGem heart, Vector2 position, int index) : base(position) { Heart = heart; heartData = new DynData <HeartGem>(Heart); this.index = index; Depth = Depths.Pickups; Collider = new Hitbox(12f, 12f, -6f, -6f); Add(holdableCollider = new HoldableCollider(OnHoldable)); Add(new PlayerCollider(OnPlayer)); moveWiggler = Wiggler.Create(0.8f, 2f); moveWiggler.StartZero = true; Add(moveWiggler); Add(collectSfx = new SoundSource()); Add(shaker = new Shaker(on: false)); shaker.Interval = 0.1f; // index % 3 determines which third of the heart this piece looks like Add(sprite = new Image(GFX.Game.GetAtlasSubtexturesAt("collectables/CommunalHelper/heartGemShard/shard", index % 3)).CenterOrigin()); Add(outline = new Image(GFX.Game.GetAtlasSubtexturesAt("collectables/CommunalHelper/heartGemShard/shard_outline", index % 3)).CenterOrigin()); Add(scaleWiggler = Wiggler.Create(0.5f, 4f, f => sprite.Scale = Vector2.One * (1f + f * 0.25f))); Add(new BloomPoint(Heart.IsFake ? 0f : 0.75f, 16f)); Add(new MirrorReflection()); }
public override void Added(Scene scene) { base.Added(scene); IsGhost = AltSidesHelperModule.AltSidesSaveData.UnlockedAltSideIDs.Contains(altSideToUnlock); string path = IsGhost ? "ghost" : "idle"; sprite = new Sprite(GFX.Game, spritePath); sprite.Add("idle", path, 0.07f, "pulse", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); sprite.Add("spin", path, 0.07f, "spin", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); sprite.Add("pulse", path, 0.04f, "idle", new int[] { 13, 14, 15, 16, 17, 18 }); sprite.CenterOrigin(); Add(sprite); sprite.Play("idle"); Add(scaleWiggler = Wiggler.Create(0.25f, 4f, delegate(float f) { sprite.Scale = Vector2.One * (1f + f * 0.25f); })); Add(bloom = new BloomPoint(0.25f, 16f)); Add(light = new VertexLight(Color.White, 0.4f, 32, 64)); Add(hover = new SineWave(0.5f, 0f)); hover.OnUpdate = delegate(float f) { Sprite obj = sprite; VertexLight vertexLight = light; float num2 = bloom.Y = f * 2f; float num5 = obj.Y = (vertexLight.Y = num2); }; if (IsGhost) { sprite.Color = Color.White * 0.8f; } }
public OuiModOptionString() : base() { wiggler = Wiggler.Create(0.25f, 4f); Position = new Vector2(0f, 1080f); Visible = false; }
public TimedSwitchGate(Vector2 position, float width, float height, Vector2 node, bool persistent, string spriteName) : base(position, width, height, false) { this.node = node; this.ogTarget = node; this.ogPosition = position; this.persistent = persistent; base.Add(icon = new Sprite(GFX.Game, "objects/switchgate/icon")); icon.Add("spin", "", 0.1f, "spin"); icon.Play("spin", false, false); icon.Rate = 0f; icon.Color = inactiveColor; icon.Position = (iconOffset = new Vector2(width / 2f, height / 2f)); icon.CenterOrigin(); base.Add(wiggler = Wiggler.Create(0.5f, 4f, delegate(float f) { icon.Scale = Vector2.One * (1f + f); }, false, false)); MTexture mTexture = GFX.Game["objects/switchgate/" + spriteName]; nineSlice = new MTexture[3, 3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { MTexture[,] array = nineSlice; int num = i; int num2 = j; MTexture subtexture = mTexture.GetSubtexture(new Rectangle(i * 8, j * 8, 8, 8)); array[num, num2] = subtexture; } } base.Add(openSfx = new SoundSource()); base.Add(new LightOcclude(0.5f)); }
public MyVariantPerPlayer(VariantToggle toggle, Vector2 position) : base(toggle, position) { base.Depth = -100; this.toggle = toggle; this.variant = toggle.Variant; this.tweenTo = base.Position; this.tweenFrom = base.Position + new Vector2(320f, 0f); this.selection = 0; for (int i = 0; i < 8; i++) { if (TFGame.Players[i]) { this.selection = i; break; } } this.wigglers = new Wiggler[8]; for (int j = 0; j < 8; j++) { if (TFGame.Players[j]) { this.wigglers[j] = Wiggler.Create(20, 5f, null, null, false, false); base.Add(this.wigglers[j]); } } this.cursor = this.GetCursorTarget(); this.cursorSine = new SineWave(60); base.Add(this.cursorSine); }
public KevinRefill(Vector2 position) : base(position) { base.Collider = new Hitbox(16f, 16f, -8f, -8f); base.Add(new PlayerCollider(OnPlayer, null, null)); base.Add(outline = new Image(GFX.Game["objects/refill/outline"])); outline.CenterOrigin(); outline.Visible = false; base.Add(sprite = new Sprite(GFX.Game, "objects/refill/idle")); sprite.AddLoop("idle", "", 0.1f); sprite.Play("idle", false, false); sprite.CenterOrigin(); base.Add(flash = new Sprite(GFX.Game, "objects/refill/flash")); flash.Add("flash", "", 0.05f); flash.OnFinish = delegate { flash.Visible = false; }; flash.CenterOrigin(); base.Add(wiggler = Wiggler.Create(1f, 4f, delegate(float v) { sprite.Scale = (flash.Scale = Vector2.One * (1f + v * 0.2f)); }, false, false)); base.Add(new MirrorReflection()); base.Add(bloom = new BloomPoint(0.8f, 16f)); base.Add(light = new VertexLight(Color.White, 1f, 16, 48)); base.Add(sine = new SineWave(0.6f)); sine.Randomize(); UpdateY(); base.Depth = -100; }
public GenericStrawberrySeed(IStrawberrySeeded strawberry, Vector2 position, int index, bool ghost) : base(position) { this.Strawberry = strawberry; base.Depth = -100; this.start = this.Position; base.Collider = new Hitbox(12f, 12f, -6f, -6f); this.index = index; this.ghost = ghost; base.Add(this.follower = new Follower(new Action(this.OnGainLeader), new Action(this.OnLoseLeader))); this.follower.FollowDelay = 0.2f; this.follower.PersistentFollow = false; base.Add(new StaticMover { SolidChecker = ((Solid s) => s.CollideCheck(this)), OnAttach = delegate(Platform p) { base.Depth = -1000000; base.Collider = new Hitbox(24f, 24f, -12f, -12f); this.attached = p; this.start = this.Position - p.Position; } }); base.Add(new PlayerCollider(new Action <Player>(this.OnPlayer), null, null)); base.Add(this.wiggler = Wiggler.Create(0.5f, 4f, delegate(float v) { this.sprite.Scale = Vector2.One * (1f + 0.2f * v); }, false, false)); base.Add(this.sine = new SineWave(0.5f, 0f).Randomize()); base.Add(this.shaker = new Shaker(false, null)); base.Add(this.bloom = new BloomPoint(1f, 12f)); base.Add(this.light = new VertexLight(Color.White, 1f, 16, 24)); base.Add(this.lightTween = this.light.CreatePulseTween()); if (P_Burst == null) { P_Burst = StrawberrySeed.P_Burst; } }
public OuiNumberEntry() : base() { wiggler = Wiggler.Create(0.25f, 4f); Position = new Vector2(0f, 1080f); Visible = false; }
public IEnumerator Respawn() { if (deathEffect == null) { Add(deathEffect = new DeathEffect(color)); image.Visible = false; yield return(deathEffect.Duration + 0.1f); respawnEase = 1f; Tween respawnTween = Tween.Create(Tween.TweenMode.Oneshot, null, 0.6f, true); respawnTween.OnUpdate = delegate(Tween t) { respawnEase = 1f - t.Eased; }; respawnTween.OnComplete = delegate { respawnEase = -1f; deathEffect = null; image.Visible = true; Vector2 normalScale = scale; Add(Wiggler.Create(0.25f, 4f, (f) => scale = normalScale * new Vector2(1, f * 0.15f + 1f), true, true)); }; Add(respawnTween); OnRespawn?.Invoke(this); } }
public Companion(Vector2 position, CompanionSphere parent, bool requiresDash) : base(position) { this.requiresDash = requiresDash; defaultPosition = position; Collider = new Hitbox(16, 16, -8, -8); ParentCollection = parent; Add(sine = new SineWave(0.6f, 0f)); sine.Randomize(); Add(new PlayerCollider(OnPlayer, new Circle(16))); Depth = Depths.Below; Add(sprite = ConnectionHelperModule.SpriteBank.Create("companion_sphere")); sprite.Play(requiresDash ? "idle" : "noDash", true, true); Add(shine = ConnectionHelperModule.SpriteBank.Create("companion_sphere")); shine.OnFinish = delegate { shine.Visible = false; }; Add(new MirrorReflection()); Add(new VertexLight(requiresDash ? Color.Pink : Color.LightBlue, 1f, 32, 48)); Add(wiggler = Wiggler.Create(0.4f, 4f, delegate(float v) { sprite.Scale = Vector2.One * (1f + v * 0.35f); })); }
public AssistSkipConfirmUI(Action onConfirm, Action onCancel) : base() { this.onConfirm = onConfirm; this.onCancel = onCancel; Tag = Tags.HUD | Tags.PauseUpdate; Add(wiggler = Wiggler.Create(0.4f, 4f)); }
public MinigameDisplay(MinigameEntity minigame) { Tag = Tags.HUD | Tags.Global | Tags.PauseUpdate | Tags.TransitionUpdate; Depth = -100; Y = 60f; CalculateBaseSizes(); Add(wiggler = Wiggler.Create(0.5f, 4f)); this.minigame = minigame; }
public MultiplayerControlSwitch(Vector2 position) : base(position) { base.Depth = 2000; base.Add(ControlSwitch = new ControlSwitch(false, 0)); base.Add(new PlayerCollider(OnPlayer, null, new Hitbox(30f, 30f, -15f, -15f))); base.Add(icon); base.Add(bloom = new BloomPoint(0f, 16f)); bloom.Alpha = 0f; icon.Add("idle", "", 0f, default(int)); icon.Add("spin", "", 0.1f, new Chooser <string>("spin", 1f), 0, 1, 2, 3, 4, 5); icon.Play("spin", false, false); icon.Color = inactiveColor; icon.CenterOrigin(); base.Collider = new Hitbox(16f, 16f, -8f, -8f); base.Add(new TheoCrystalCollider(OnTheoCrystal, new Hitbox(20f, 20f, -10f, -10f))); base.Add(new SeekerCollider(OnSeeker, new Hitbox(24f, 24f, -12f, -12f))); ControlSwitch.OnActivate = delegate { wiggler.Start(); for (int i = 0; i < 32; i++) { float num = Calc.Random.NextFloat(6.28318548f); //level.Particles.Emit(P_FireWhite, base.Position + Calc.AngleToVector(num, 6f), num); } icon.Rate = 4f; }; ControlSwitch.OnDeactivate = delegate { wiggler.StopAndClear(); icon.Rate = 0.1f; icon.Play("spin", false, false); }; ControlSwitch.OnFinish = delegate { ease = 0f; }; ControlSwitch.OnStartFinished = delegate { icon.Rate = 0.1f; icon.Play("spin", false, false); ease = 1f; }; base.Add(wiggler = Wiggler.Create(0.5f, 4f, delegate(float v) { pulse = Vector2.One * (1f + v * 0.25f); }, false, false)); base.Add(new VertexLight(Color.White, 0.8f, 16, 32)); base.Add(touchSfx = new SoundSource()); }
private void SetCrystalHeartSprite(On.Celeste.HeartGem.orig_Awake orig, HeartGem self, Scene scene) { orig(self, scene); if (!self.IsFake) { var data = AreaData.Get((scene as Level).Session.Area); var meta = GetModeMetaForAltSide(data); if (meta != null) { Logger.Log("AltSidesHelper", $"In-world heart customisation: found metadata for \"{data.SID}\"."); if (meta.OverrideHeartTextures) { Logger.Log("AltSidesHelper", $"Replacing crystal heart texture for \"{data.SID}\"."); var selfdata = new DynData <HeartGem>(self); if (!self.IsGhost) { var sprite = new Sprite(GFX.Game, meta.InWorldHeartIcon); sprite.CenterOrigin(); sprite.AddLoop("idle", "", 0, new int[] { 0 }); sprite.AddLoop("spin", "", 0.1f, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }); sprite.AddLoop("fastspin", "", 0.1f); sprite.CenterOrigin(); sprite.OnLoop = delegate(string anim) { if (self.Visible && anim == "spin" && (bool)selfdata["autoPulse"]) { Audio.Play("event:/game/general/crystalheart_pulse", self.Position); self.ScaleWiggler.Start(); (scene as Level).Displacement.AddBurst(self.Position, 0.35f, 8f, 48f, 0.25f); } }; sprite.Play("spin"); self.ScaleWiggler.RemoveSelf(); self.ScaleWiggler = Wiggler.Create(0.5f, 4f, delegate(float f) { sprite.Scale = Vector2.One * (1f + f * 0.25f); }); self.Add(self.ScaleWiggler); ((Component)selfdata["sprite"]).RemoveSelf(); selfdata["sprite"] = sprite; self.Add(sprite); } var colour = Calc.HexToColor(meta.HeartColour); selfdata["shineParticle"] = new ParticleType(HeartGem.P_BlueShine) { Color = colour }; selfdata.Get <VertexLight>("light").RemoveSelf(); var newLight = new VertexLight(Color.Lerp(colour, Color.White, 0.5f), 1f, 32, 64); self.Add(newLight); selfdata["light"] = newLight; } } } }
public OuiSoundTest() { wigglerDigits = new Wiggler[digits.Length]; for (int i = 0; i < digits.Length; i++) { wigglerDigits[i] = Wiggler.Create(0.25f, 4f); } wigglerPath = Wiggler.Create(0.25f, 4f); Position = new Vector2(0f, 1080f); Visible = false; }
public FlagTouchSwitch(EntityData data, Vector2 offset) : base(data.Position + offset) { Depth = 2000; id = data.ID; flag = data.Attr("flag"); persistent = data.Bool("persistent", false); inactiveColor = Calc.HexToColor(data.Attr("inactiveColor", "5FCDE4")); activeColor = Calc.HexToColor(data.Attr("activeColor", "FFFFFF")); finishColor = Calc.HexToColor(data.Attr("finishColor", "F141DF")); hitSound = data.Attr("hitSound", "event:/game/general/touchswitch_any"); completeSoundFromSwitch = data.Attr("completeSoundFromSwitch", "event:/game/general/touchswitch_last_cutoff"); completeSoundFromScene = data.Attr("completeSoundFromScene", "event:/game/general/touchswitch_last_oneshot"); inverted = data.Bool("inverted", false); allowDisable = data.Bool("allowDisable", false); smoke = data.Bool("smoke", true); P_RecoloredFire = new ParticleType(TouchSwitch.P_Fire) { Color = finishColor }; // set up collision Collider = new Hitbox(16f, 16f, -8f, -8f); Add(new PlayerCollider(onPlayer, null, new Hitbox(30f, 30f, -15f, -15f))); Add(new HoldableCollider(onHoldable, new Hitbox(20f, 20f, -10f, -10f))); Add(new SeekerCollider(onSeeker, new Hitbox(24f, 24f, -12f, -12f))); // set up the icon string iconAttribute = data.Attr("icon", "vanilla"); icon = new Sprite(GFX.Game, iconAttribute == "vanilla" ? "objects/touchswitch/icon" : $"objects/MaxHelpingHand/flagTouchSwitch/{iconAttribute}/icon"); Add(icon); icon.Add("idle", "", 0f, default(int)); icon.Add("spin", "", 0.1f, new Chooser <string>("spin", 1f), 0, 1, 2, 3, 4, 5); icon.Play("spin"); icon.Color = inactiveColor; icon.CenterOrigin(); Add(bloom = new BloomPoint(0f, 16f)); bloom.Alpha = 0f; Add(wiggler = Wiggler.Create(0.5f, 4f, v => { pulse = Vector2.One * (1f + v * 0.25f); })); Add(new VertexLight(Color.White, 0.8f, 16, 32)); Add(touchSfx = new SoundSource()); }
public ChronosDisplay(ChronosTrigger challenge) { Tag = Tags.HUD | Tags.PauseUpdate | Tags.Persistent; Add(Wiggler.Create(0.5f, 4f, null, false, false)); TrackedTrigger = challenge; fadeTime = 3f; createTween(0.1f, t => { Position = Vector2.Lerp(OffscreenPos, OnscreenPos, t.Eased); }); }
// // Constructors // public MyChaliceGhost(int ownerIndex, MyChalice source, bool huntsGhosts = false) { base.Depth = -1000000; base.Tag(new GameTags[] { GameTags.PlayerCollider, GameTags.PlayerGhostCollider, GameTags.LightSource }); base.Collider = new WrapHitbox(14f, 14f, -7f, -7f); this.Collidable = false; this.huntsGhosts = huntsGhosts; this.ownerIndex = ownerIndex; this.source = source; this.ScreenWrap = true; this.LightAlpha = 0f; this.LightRadius = 60f; this.cloak = TFGame.SpriteData.GetSpriteString("ChaliceGhostTeamColor"); base.Add(this.cloak); this.sprite = TFGame.SpriteData.GetSpriteString("ChaliceGhost"); this.sprite.Play("spawn", false); this.sprite.Color = Color.White * 0.75f; base.Add(this.sprite); this.sprite.OnAnimationComplete = delegate(Sprite <string> s) { if (s.CurrentAnimID == "attack") { s.Play("idle", false); } else if (s.CurrentAnimID == "spawn") { s.Play("idle", false); this.spawned = true; } else if (s.CurrentAnimID == "death") { base.RemoveSelf(); } }; this.Position = source.Position + new Vector2(0f, -34f); Tween tween = Tween.Create(Tween.TweenMode.Oneshot, Ease.BackOut, 15, true); tween.OnUpdate = delegate(Tween t) { this.LightAlpha = t.Eased; }; base.Add(tween); base.Add(new Coroutine(this.Sequence())); this.wiggler = Wiggler.Create(30, 4f, null, delegate(float v) { this.sprite.Scale = Vector2.One * (1f + v * 0.2f); }, false, false); base.Add(this.wiggler); Sounds.sfx_chaliceGhostAppear.Play(210f, 1f); }
public SpeedBerryTimerDisplay(SpeedBerry berry) { drawLerp = 0f; Tag = (Tags.HUD | Tags.Global | Tags.PauseUpdate | Tags.TransitionUpdate); calculateBaseSizes(); Add(wiggler = Wiggler.Create(0.5f, 4f, null, false, false)); TrackedBerry = berry; timerEnded = false; fadeTime = 3f; createTween(0.6f, t => { Position = Vector2.Lerp(offscreenPosition, onscreenPosition, t.Eased); }); }
public SpeedRingTimerDisplay(SpeedRingChallenge challenge) { Tag = Tags.HUD | Tags.PauseUpdate; CalculateBaseSizes(); Add(Wiggler.Create(0.5f, 4f, null, false, false)); TrackedChallenge = challenge; fadeTime = 3f; CreateTween(0.1f, t => { Position = Vector2.Lerp(OffscreenPos, OnscreenPos, t.Eased); }); Name = Dialog.Clean(challenge.ChallengeNameID); NameMeasure = ActiveFont.Measure(Name); }
public DreamSwitchGate(EntityData data, Vector2 offset) : base(data, offset) { permanent = data.Bool("permanent"); node = data.Nodes[0] + offset; isFlagSwitchGate = data.Bool("isFlagSwitchGate"); ID = data.ID; Flag = data.Attr("flag"); inactiveColor = Calc.HexToColor(data.Attr("inactiveColor", "5FCDE4")); activeColor = Calc.HexToColor(data.Attr("activeColor", "FFFFFF")); finishColor = Calc.HexToColor(data.Attr("finishColor", "F141DF")); shakeTime = data.Float("shakeTime", 0.5f); moveTime = data.Float("moveTime", 1.8f); moveEased = data.Bool("moveEased", true); moveSound = data.Attr("moveSound", SFX.game_gen_touchswitch_gate_open); finishedSound = data.Attr("finishedSound", SFX.game_gen_touchswitch_gate_finish); allowReturn = data.Bool("allowReturn"); P_RecoloredFire = new ParticleType(TouchSwitch.P_Fire) { Color = finishColor }; P_RecoloredFireBack = new ParticleType(TouchSwitch.P_Fire) { Color = inactiveColor }; string iconAttribute = data.Attr("icon", "vanilla"); icon = new Sprite(GFX.Game, iconAttribute == "vanilla" ? "objects/switchgate/icon" : $"objects/MaxHelpingHand/flagSwitchGate/{iconAttribute}/icon"); icon.Add("spin", "", 0.1f, "spin"); icon.Play("spin"); icon.Rate = 0f; icon.Color = inactiveColor; icon.CenterOrigin(); iconOffset = new Vector2(Width, Height) / 2f; Add(wiggler = Wiggler.Create(0.5f, 4f, scale => { icon.Scale = Vector2.One * (1f + scale); })); Add(openSfx = new SoundSource()); }
public AbstractMiniHeart(EntityData data, Vector2 position, EntityID gid) : base(data.Position + position) { spriteName = data.Attr("sprite"); Collider = new Hitbox(12f, 12f, -6f, -6f); Add(scaleWiggler = Wiggler.Create(0.5f, 4f, f => { sprite.Scale = Vector2.One * (1f + f * 0.3f); })); moveWiggler = Wiggler.Create(0.8f, 2f); moveWiggler.StartZero = true; Add(moveWiggler); Add(new PlayerCollider(onPlayer)); Add(holdableCollider = new HoldableCollider(onHoldable)); }
public CustomSummitGem(EntityData data, Vector2 offset, EntityID gid) : base(data, offset, gid) { baseData = new DynData <SummitGem>(this); GemID = data.Int("index"); // Hopefully this always works string mapId = AreaData.Get((Engine.Scene as Level)?.Session ?? (Engine.Scene as LevelLoader).Level.Session).SID; CustomGemSID = $"{mapId}/{data.Level.Name}/{GemID}"; Sprite sprite = baseData.Get <Sprite>("sprite"); Remove(sprite); if (GFX.Game.Has("collectables/summitgems/" + CustomGemSID + "/gem00")) { sprite = new Sprite(GFX.Game, "collectables/summitgems/" + CustomGemSID + "/gem"); } else { sprite = new Sprite(GFX.Game, "collectables/summitgems/" + GemID + "/gem"); } sprite.AddLoop("idle", "", 0.08f); sprite.Play("idle"); sprite.CenterOrigin(); Add(sprite); Remove(baseData.Get <Wiggler>("scaleWiggler")); Wiggler scaleWiggler = Wiggler.Create(0.5f, 4f, f => sprite.Scale = Vector2.One * (1f + f * 0.3f)); Add(scaleWiggler); if (CommunalHelperModule.SaveData.SummitGems != null && CommunalHelperModule.SaveData.SummitGems.Contains(CustomGemSID)) { sprite.Color = Color.White * 0.5f; } if (Everest.Content.TryGet <AssetTypeYaml>(GFX.Game.RelativeDataPath + "collectables/summitgems/" + CustomGemSID + "/gem.meta", out ModAsset asset) && asset.TryDeserialize(out ColorMeta meta)) { particleColor = Calc.HexToColor(meta.Color); } baseData["sprite"] = sprite; }
public BadelineBoostDown(Vector2[] nodes) : base(nodes[0]) { Depth = -1000000; this.nodes = nodes; Collider = new Circle(16f); Add(new PlayerCollider(OnPlayer)); Add(sprite = GFX.SpriteBank.Create("badelineBoost")); Add(stretch = new Image(GFX.Game["objects/badelineboost/stretch"])); stretch.Visible = false; stretch.CenterOrigin(); Add(light = new VertexLight(Color.White, 0.7f, 12, 20)); Add(bloom = new BloomPoint(0.5f, 12f)); Add(wiggler = Wiggler.Create(0.4f, 3f, f => sprite.Scale = Vector2.One * (float)(1.0 + (double)wiggler.Value * 0.400000005960464))); Add(relocateSfx = new SoundSource()); }
public Battery(Vector2 position, EntityID id) : base(position) { ID = id; Collider = new Hitbox(12f, 12f, -6f, -6f); Add(follower = new Follower(id)); Add(new PlayerCollider(OnPlayer)); Add(new MirrorReflection()); Add(sprite = FactoryHelperModule.SpriteBank.Create("battery")); sprite.CenterOrigin(); sprite.Play("rotating"); Add(new TransitionListener { OnOut = delegate { StartedUsing = false; if (!IsUsed) { if (tween != null) { tween.RemoveSelf(); tween = null; } if (alarm != null) { alarm.RemoveSelf(); alarm = null; } Turning = false; Visible = true; sprite.Visible = true; sprite.Rate = 1f; sprite.Scale = Vector2.One; sprite.Play("rotating"); sprite.Rotation = 0f; wiggler.Stop(); follower.MoveTowardsLeader = true; } } }); Add(wiggler = Wiggler.Create(0.4f, 4f, delegate(float v) { sprite.Scale = Vector2.One * (1f + v * 0.35f); })); Add(light = new VertexLight(Color.LightSeaGreen, 1f, 32, 48)); }
public FlagSwitchGate(EntityData data, Vector2 offset) : base(data.Position + offset, data.Width, data.Height, safe: false) { node = data.Nodes[0] + offset; Flag = data.Attr("flag"); persistent = data.Bool("persistent"); inactiveColor = Calc.HexToColor(data.Attr("inactiveColor", "5FCDE4")); activeColor = Calc.HexToColor(data.Attr("activeColor", "FFFFFF")); finishColor = Calc.HexToColor(data.Attr("finishColor", "F141DF")); P_RecoloredFire = new ParticleType(TouchSwitch.P_Fire) { Color = finishColor }; string iconAttribute = data.Attr("icon", "vanilla"); icon = new Sprite(GFX.Game, iconAttribute == "vanilla" ? "objects/switchgate/icon" : $"objects/SpringCollab2020/flagSwitchGate/{iconAttribute}/icon"); Add(icon); icon.Add("spin", "", 0.1f, "spin"); icon.Play("spin"); icon.Rate = 0f; icon.Color = inactiveColor; icon.Position = (iconOffset = new Vector2(data.Width / 2f, data.Height / 2f)); icon.CenterOrigin(); Add(wiggler = Wiggler.Create(0.5f, 4f, f => { icon.Scale = Vector2.One * (1f + f); })); MTexture nineSliceTexture = GFX.Game["objects/switchgate/" + data.Attr("sprite", "block")]; nineSlice = new MTexture[3, 3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { nineSlice[i, j] = nineSliceTexture.GetSubtexture(new Rectangle(i * 8, j * 8, 8, 8)); } } Add(openSfx = new SoundSource()); Add(new LightOcclude(0.5f)); }
// Basically the same as Add(), but with an index parameter. /// <summary> /// Insert a <see cref="TextMenu.Item"/> at position <paramref name="index"/> in the menu. /// </summary> /// <param name="index"></param> /// <param name="item"></param> /// <returns></returns> public TextMenu Insert(int index, Item item) { items.Insert(index, item); item.Container = this; Add(item.ValueWiggler = Wiggler.Create(0.25f, 3f, null, false, false)); Add(item.SelectWiggler = Wiggler.Create(0.25f, 3f, null, false, false)); item.ValueWiggler.UseRawDeltaTime = item.SelectWiggler.UseRawDeltaTime = true; if (Selection == -1) { FirstSelection(); } RecalculateSize(); item.Added(); return(this); }
public GenericCustomBooster(EntityData data, Vector2 offset) : base(data.Position + offset) { Depth = -8500; Collider = new Circle(10f, 0f, 2f); sprite = new Sprite(GFX.Game, data.Attr("directory", "objects/FrostHelper/blueBooster/")) { Visible = true }; sprite.CenterOrigin(); sprite.Justify = new Vector2(0.5f, 0.5f); sprite.AddLoop("loop", "booster", 0.1f, 0, 1, 2, 3, 4); sprite.AddLoop("inside", "booster", 0.1f, 5, 6, 7, 8); sprite.AddLoop("spin", "booster", 0.06f, 18, 19, 20, 21, 22, 23, 24, 25); sprite.Add("pop", "booster", 0.08f, 9, 10, 11, 12, 13, 14, 15, 16, 17); sprite.Play("loop", false); Add(sprite); Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null)); Add(light = new VertexLight(Color.White, 1f, 16, 32)); Add(bloom = new BloomPoint(0.1f, 16f)); Add(wiggler = Wiggler.Create(0.5f, 4f, delegate(float f) { sprite.Scale = Vector2.One * (1f + f * 0.25f); }, false, false)); Add(dashRoutine = new Coroutine(false)); Add(dashListener = new DashListener()); dashListener.OnDash = new Action <Vector2>(OnPlayerDashed); Add(new MirrorReflection()); Add(loopingSfx = new SoundSource()); Red = data.Bool("red", false); particleType = Red ? Booster.P_BurstRed : Booster.P_Burst; RespawnTime = data.Float("respawnTime", 1f); BoostTime = data.Float("boostTime", 0.3f); ParticleColor = ColorHelper.GetColor(data.Attr("particleColor", "Yellow")); reappearSfx = data.Attr("reappearSfx", "event:/game/04_cliffside/greenbooster_reappear"); enterSfx = data.Attr("enterSfx", "event:/game/04_cliffside/greenbooster_enter"); boostSfx = data.Attr("boostSfx", "event:/game/04_cliffside/greenbooster_dash"); endSfx = data.Attr("releaseSfx", "event:/game/04_cliffside/greenbooster_end"); }