public override void Added(Scene scene) { base.Added(scene); // Hack to determine sprite color without resorting to a switch statement XNAColor color = Color ?? (Heart.IsGhost ? new XNAColor(130, 144, 198) : Heart.Get <VertexLight>().Color); sprite.Color = color; shineParticle = heartData.Get <ParticleType>("shineParticle"); if (Color != null) { shineParticle.Color = Color.Value; } Add(light = new VertexLight(color, 1f, 32, 64)); Add(lightTween = light.CreatePulseTween()); }
public override void Added(Scene scene) { base.Added(scene); Add(_wiggler = Wiggler.Create(0.4f, 4f, delegate(float v) { _sprite.Scale = Vector2.One * (1f + v * 0.35f); })); Add(_rotateWiggler = Wiggler.Create(0.5f, 4f, delegate(float v) { _sprite.Rotation = v * 30f * ((float)Math.PI / 180f); })); Add(_bloom = new BloomPoint(_isGhostBerry ? 0.5f : 1f, 12f)); Add(_light = new VertexLight(Color.RosyBrown, 1f, 16, 24)); Add(_lightTween = _light.CreatePulseTween()); if ((scene as Level).Session.BloomBaseAdd > 0.1f) { _bloom.Alpha *= 0.5f; } }
public NoOverlayLookout(EntityData data, Vector2 offset) : base(data.Position + offset) { Depth = Depths.Above; Add(talk = new TalkComponent(new Rectangle(-24, -8, 48, 8), new Vector2(-0.5f, -20f), Interact) { PlayerMustBeFacing = false, }); summit = data.Bool("summit"); onlyY = data.Bool("onlyY"); Collider = new Hitbox(4f, 4f, -2f, -4f); VertexLight vertexLight = new VertexLight(new Vector2(-1f, -11f), Color.White, 0.8f, 16, 24); Add(vertexLight); lightTween = vertexLight.CreatePulseTween(); Add(lightTween); Add(sprite = GFX.SpriteBank.Create("lookout")); sprite.OnFrameChange = delegate(string s) { switch (s) { case "idle": case "badeline_idle": case "nobackpack_idle": if (sprite.CurrentAnimationFrame == sprite.CurrentAnimationTotalFrames - 1) { lightTween.Start(); } break; } }; Vector2[] array = data.NodesOffset(offset); if (array != null && array.Length != 0) { nodes = new List <Vector2>(array); } }
public GenericStrawberrySeed(IStrawberrySeeded strawberry, Vector2 position, int index, bool ghost) : base(position) { Strawberry = strawberry; Depth = Depths.Pickups; start = Position; Collider = new Hitbox(12f, 12f, -6f, -6f); this.index = index; this.ghost = ghost; Add(follower = new Follower(OnGainLeader, OnLoseLeader)); follower.FollowDelay = 0.2f; follower.PersistentFollow = false; Add(new StaticMover { SolidChecker = solid => solid.CollideCheck(this), OnAttach = platform => { Depth = Depths.Top; Collider = new Hitbox(24f, 24f, -12f, -12f); attached = platform; start = Position - platform.Position; } }); Add(new PlayerCollider(OnPlayer)); Add(wiggler = Wiggler.Create(0.5f, 4f, v => { sprite.Scale = Vector2.One * (1f + 0.2f * v); }, false, false)); Add(sine = new SineWave(0.5f, 0f).Randomize()); Add(shaker = new Shaker(false, null)); Add(bloom = new BloomPoint(1f, 12f)); Add(light = new VertexLight(Color.White, 1f, 16, 24)); Add(lightTween = light.CreatePulseTween()); if (P_Burst == null) { P_Burst = StrawberrySeed.P_Burst; } }
public override void Added(Scene scene) { base.Added(scene); Add(sprite = GFX.SpriteBank.Create("strawberry")); if (Winged) { sprite.Play("flap", false, false); } sprite.OnFrameChange = new Action <string>(OnAnimate); Add(wiggler = Wiggler.Create(0.4f, 4f, delegate(float v) { sprite.Scale = Vector2.One * (1f + v * 0.35f); }, false, false)); Add(rotateWiggler = Wiggler.Create(0.5f, 4f, delegate(float v) { sprite.Rotation = v * 30f * 0.0174532924f; }, false, false)); Add(bloom = new BloomPoint(1f, 12f)); Add(light = new VertexLight(Color.White, 1f, 16, 24)); Add(lightTween = light.CreatePulseTween()); if ((scene as Level).Session.BloomBaseAdd > 0.1f) { bloom.Alpha *= 0.5f; } }
// When a new Strawberry is "added" to a scene, we need it to initialize certain features, most of them visual in nature. public override void Added(Scene scene) { base.Added(scene); sprite = spriteBank.Create("springCollabGlassBerry"); Add(sprite); if (!isOwned) { sprite.Play("idle"); } else { sprite.Play("idleGhost"); } // Strawberries have certain special effects during their animation sequence. // This adds a handler to enable this. sprite.OnFrameChange = OnAnimate; // A Wiggler is capable of "shaking" and "pulsing" sprites. // This Wiggler adjusts the sprite's Scale when triggered. wiggler = Wiggler.Create ( 0.4f, 4f, delegate(float v) { sprite.Scale = Vector2.One * (1f + v * 0.35f); }, false, false ); Add(wiggler); // Bloom makes bright things brighter! // The default BloomPoint for a vanilla Strawberry is // alpha = (this.Golden || this.Moon || this.isGhostBerry) ? 0.5f : 1f // radius = 12f bloom = new BloomPoint(isOwned ? 0.25f : 0.5f, 12f); Add(bloom); // Strawberries give off light. This is the vanilla VertexLight. light = new VertexLight(Color.White, 1f, 16, 24); lightTween = light.CreatePulseTween(); Add(light); Add(lightTween); // While we're here, a seeded Strawberry must be allowed to initialize its Seeds. if (Seeds != null && Seeds.Count > 0 && !SceneAs <Level>().Session.GetFlag(gotSeedFlag)) { foreach (GenericStrawberrySeed seed in Seeds) { scene.Add(seed); } // If we added the seeds, we don't want to see or touch the strawberry, do we? Visible = false; Collidable = false; bloom.Visible = light.Visible = false; } // Let's be polite and turn down the bloom a little bit if the base level has bloom. if (SceneAs <Level>().Session.BloomBaseAdd > 0.1f) { bloom.Alpha *= 0.5f; } // The Glass Berry's gimmick is that it breaks if the player dashes while carrying it. // So we need a generic DashListener. Add(new DashListener { OnDash = OnDash }); }
public override void Added(Scene scene) { base.Added(scene); if (SaveData.Instance.CheckStrawberry(ID)) { if (Moon) { sprite = GFX.SpriteBank.Create("moonghostberry"); } else if (Golden) { sprite = GFX.SpriteBank.Create("goldghostberry"); } else { sprite = GFX.SpriteBank.Create("ghostberry"); } sprite.Color = Color.White * 0.8f; } else if (Moon) { sprite = GFX.SpriteBank.Create("moonberry"); } else if (Golden) { sprite = GFX.SpriteBank.Create("goldberry"); } else { sprite = GFX.SpriteBank.Create("strawberry"); } Add(sprite); if (Winged) { sprite.Play("flap"); } sprite.OnFrameChange = OnAnimate; Add(wiggler = Wiggler.Create(0.4f, 4f, delegate(float v) { sprite.Scale = Vector2.One * (1f + v * 0.35f); })); Add(rotateWiggler = Wiggler.Create(0.5f, 4f, delegate(float v) { sprite.Rotation = v * 30f * ((float)Math.PI / 180f); })); Add(bloom = new BloomPoint((Golden || Moon || isGhostBerry) ? 0.5f : 1f, 12f)); Add(light = new VertexLight(Color.White, 1f, 16, 24)); Add(lightTween = light.CreatePulseTween()); if (Seeds != null && Seeds.Count > 0) { Session session = (scene as Level).Session; if (!session.GetFlag(gotSeedFlag)) { foreach (GenericStrawberrySeed seed in Seeds) { scene.Add(seed); } Visible = false; Collidable = false; WaitingOnSeeds = true; bloom.Visible = (light.Visible = false); } } if ((scene as Level).Session.BloomBaseAdd > 0.1f) { bloom.Alpha *= 0.5f; } }