public SpiceBloom(ActorInitializer init, SpiceBloomInfo info) { this.info = info; self = init.Self; resLayer = self.World.WorldActor.Trait <ResourceLayer>(); resType = self.World.WorldActor.TraitsImplementing <ResourceType>().First(t => t.Info.Name == info.ResourceType); var render = self.Trait <RenderSprites>(); anim = new AnimationWithOffset(new Animation(init.Self.World, render.GetImage(self)), null, () => self.IsDead); render.Add(anim); respawnTicks = self.World.SharedRandom.Next(info.RespawnDelay[0], info.RespawnDelay[1]); growTicks = self.World.SharedRandom.Next(info.GrowthDelay[0], info.GrowthDelay[1]); anim.Animation.Play(info.GrowthSequences[0]); }
public SpiceBloom(Actor self, SpiceBloomInfo info) { this.info = info; resourceLayer = self.World.WorldActor.Trait <IResourceLayer>(); var rs = self.Trait <RenderSprites>(); body = new Animation(self.World, rs.GetImage(self)); rs.Add(new AnimationWithOffset(body, null, () => self.IsDead)); growTicks = self.World.SharedRandom.Next(info.Lifetime[0], info.Lifetime[1]); body.Play(info.GrowthSequences[0]); spurt = new Animation(self.World, rs.GetImage(self)); rs.Add(new AnimationWithOffset(spurt, null, () => !showSpurt)); spurt.PlayThen(info.SpurtSequence, () => showSpurt = false); }