public FrozenBuff(Being being, TimeSpan length) : base(null, being, length, true, frozen: true) { Texture = TextureCacheFactory.Get("Buffs/cold.png"); Animation = new Animation(""); Animation.AddFrame(Texture.Bounds, TimeSpan.FromSeconds(0.15)); }
//Custom load for AttackDog protected override void loadAnimations() { Animation run1 = new Animation(); run1.AddFrame(new Rectangle(0, 0, 47, 27), TimeSpan.FromSeconds(1.0)); animations.Add(run1); Animation run2 = new Animation(); run2.AddFrame(new Rectangle(47, 0, 47, 27), TimeSpan.FromSeconds(1.0)); animations.Add(run2); Animation run3 = new Animation(); run3.AddFrame(new Rectangle(94, 0, 47, 27), TimeSpan.FromSeconds(1.0)); animations.Add(run3); }
public void AddAnimationFrame(String fileName, long timer) { animation.AddFrame(fileName, timer); }
protected override void loadAnimations() { Animation idle = new Animation(); idle.AddFrame(new Rectangle(0, 0, 72, 71), TimeSpan.FromSeconds(1.0)); animations.Add(idle); }
private Dictionary<string, Animation> GetPlayerAnimations() { // Should read from some file or something var animations = new Dictionary<string, Animation>(); var idle = new Animation(); idle.AddFrame(float.MaxValue, new Rectangle(0, 0, 32, 32)); animations.Add("idle", idle); var moveleft = new Animation(); moveleft.AddFrame(100.8f, new Rectangle(352, 0, 32, 32)); moveleft.AddFrame(100.2f, new Rectangle(384, 0, 32, 32)); animations.Add("moveleft", moveleft); var moveright = new Animation(); moveright.AddFrame(100.8f, new Rectangle(416, 0, 32, 32)); moveright.AddFrame(100.2f, new Rectangle(448, 0, 32, 32)); animations.Add("moveright", moveright); var moveup = new Animation(); moveup.AddFrame(100.8f, new Rectangle(480, 0, 32, 32)); moveup.AddFrame(100.2f, new Rectangle(512, 0, 32, 32)); animations.Add("moveup", moveup); var movedown = new Animation(); movedown.AddFrame(100.8f, new Rectangle(288, 0, 32, 32)); movedown.AddFrame(100.2f, new Rectangle(320, 0, 32, 32)); animations.Add("movedown", movedown); return animations; }
private void ReadAnimationKeyframe(Animation animation) { var time = _reader.ReadSingle(); var keyframe = animation.AddFrame(time); var modelPartAnimStateCount = _reader.ReadInt32(); for (var i = 0; i < modelPartAnimStateCount; i++) { ReadModelPartAnimState(keyframe); } if (_modelFormat >= ModelFormat.Emf3) { var anchorAnimStateCount = _reader.ReadInt32(); for (var i = 0; i < anchorAnimStateCount; i++) { ReadAnchorAnimState(keyframe); } } }
public CharmBuff(Being creator, Being being) : base(creator, being, TimeSpan.MaxValue, true, damagePerSecond: AbilityConstants.CharmDegeneration) { Texture = TextureCacheFactory.Get("Buffs/charm.png"); Animation = new Animation(""); Animation.AddFrame(Texture.Bounds, TimeSpan.FromSeconds(0.15)); }
public override void BufferFrames() { var walkDown = new Animation("WalkDown"); walkDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkDown.AddFrame(new Rectangle(16, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkDown.AddFrame(new Rectangle(32, 0, 16, 16), TimeSpan.FromSeconds(.25)); var walkUp = new Animation("WalkUp"); walkUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkUp.AddFrame(new Rectangle(160, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkUp.AddFrame(new Rectangle(176, 0, 16, 16), TimeSpan.FromSeconds(.25)); var walkLeft = new Animation("WalkLeft"); walkLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkLeft.AddFrame(new Rectangle(64, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkLeft.AddFrame(new Rectangle(80, 0, 16, 16), TimeSpan.FromSeconds(.25)); var walkRight = new Animation("WalkRight"); walkRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkRight.AddFrame(new Rectangle(112, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25)); walkRight.AddFrame(new Rectangle(128, 0, 16, 16), TimeSpan.FromSeconds(.25)); this.animations.Add(walkDown); this.animations.Add(walkUp); this.animations.Add(walkLeft); this.animations.Add(walkRight); // Standing animations only have a single frame of animation: var standDown = new Animation("StandDown"); standDown.AddFrame(new Rectangle(0, 0, 16, 16), TimeSpan.FromSeconds(.25)); var standUp = new Animation("StandUp"); standUp.AddFrame(new Rectangle(144, 0, 16, 16), TimeSpan.FromSeconds(.25)); var standLeft = new Animation("StandLeft"); standLeft.AddFrame(new Rectangle(48, 0, 16, 16), TimeSpan.FromSeconds(.25)); var standRight = new Animation("StandRight"); standRight.AddFrame(new Rectangle(96, 0, 16, 16), TimeSpan.FromSeconds(.25)); this.animations.Add(standDown); this.animations.Add(standUp); this.animations.Add(standLeft); this.animations.Add(standRight); }
public FrostDemon(MapSection section) : base(EnemyTypes.FrostDemon, EnemyConstants.GetFrostDemonProperties(), "Entities/FrostDemon.png", section) { _ai = new RangeAI(this, EnemyConstants.FrostDemonAggroRange, EnemyConstants.FrostDemonWanderLength, new RangeAttack(this, 14, 17, MissileTypes.FrostDemonMissile, EnemyConstants.FrostDemonMissileCooldown)); HitboxSize = 0.93f; Width = 64; Height = 64; AttackRange = 400; Animations = new AnimationList(); var spawnAnimation = new Animation(AnimationTypes.Spawn); spawnAnimation.AddFrame(new Rectangle(0, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.05), SpawnedFunc); Animations.Add(spawnAnimation); var walkAnimation = new Animation(AnimationTypes.Move); walkAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); walkAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); Animations.Add(walkAnimation); var attackAnimation = new Animation(AnimationTypes.Attack); attackAnimation.AddFrame(new Rectangle(TextureSize * 0, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 1, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 2, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 3, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 4, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 5, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), AttackedFunc); attackAnimation.AddFrame(new Rectangle(TextureSize * 6, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 7, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); attackAnimation.AddFrame(new Rectangle(TextureSize * 7, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.05), DoneAttackingFunc); Animations.Add(attackAnimation); var dieAnimation = new Animation(AnimationTypes.Death); dieAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), OnDeath); dieAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25)); dieAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), OnDeathFinished); Animations.Add(dieAnimation); }
public AnimationBuilder InsertFrame(int time, int duration, Sprite sprite) { animation.AddFrame(time, duration, sprite); return(this); }
public LavaBlastMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/lava_blast.png") { Damage = damageInstance; Width = 86; Height = 86; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.FireballDistance * (1 + zerd.Player.AbilityUpgrades[AbilityUpgradeType.LavaBlastDistance] / 100f); Speed = AbilityConstants.FireballSpeed; Velocity = Creator.Facing.Normalized(); TargetsHit = new List <Being>(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03)); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.91f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.82f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.73f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.64f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.55f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.46f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.37f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.28f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.19f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.1f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), DeathFunc); Animations.Add(deathAnimation); }
public SkeletonKing(MapSection section) : base(EnemyTypes.SkeletonKing, EnemyConstants.GetSkeletonKingProperties(), "Entities/Zomb-King.png", section) { _ai = new SkeletonKingAI(this, new Melee(this, EnemyConstants.SkeletonKingMinDamage, EnemyConstants.SkeletonKingMaxDamage, null, EnemyConstants.SkeletonKingKnockback, EnemyConstants.SkeletonKingKnockbackMillis), new SkeletonKingBlast(this)); HitboxSize = 0.8f; Width = 312; Height = 312; AttackRange = 130; Spawned = true; Animations = new AnimationList(); var walkAnimation = new Animation(AnimationTypes.Move, new BodyPart(BodyPartType.Custom, 470, 370)); walkAnimation.AddFrame(0, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(1, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(2, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(1, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(0, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(3, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(4, 0, TimeSpan.FromSeconds(0.3)); walkAnimation.AddFrame(3, 0, TimeSpan.FromSeconds(0.3)); Animations.Add(walkAnimation); var attackAnimation = new Animation(AnimationTypes.Attack, new BodyPart(BodyPartType.Custom, 470, 370)); attackAnimation.AddFrame(1, 1, TimeSpan.FromSeconds(0.05)); attackAnimation.AddFrame(2, 1, TimeSpan.FromSeconds(0.05)); attackAnimation.AddFrame(3, 1, TimeSpan.FromSeconds(0.05)); attackAnimation.AddFrame(4, 1, TimeSpan.FromSeconds(0.05)); attackAnimation.AddFrame(5, 1, TimeSpan.FromSeconds(0.05), Rotate); attackAnimation.AddFrame(6, 1, TimeSpan.FromSeconds(0.05), Rotate); attackAnimation.AddFrame(7, 1, TimeSpan.FromSeconds(0.05), Rotate); attackAnimation.AddFrame(0, 2, TimeSpan.FromSeconds(0.05), Rotate); attackAnimation.AddFrame(1, 2, TimeSpan.FromSeconds(0.05), AttackedFunc); attackAnimation.AddFrame(2, 2, TimeSpan.FromSeconds(0.05), Unrotate); attackAnimation.AddFrame(3, 2, TimeSpan.FromSeconds(0.05), Unrotate); attackAnimation.AddFrame(4, 2, TimeSpan.FromSeconds(0.05), Unrotate); attackAnimation.AddFrame(5, 2, TimeSpan.FromSeconds(0.05), Unrotate); attackAnimation.AddFrame(5, 2, TimeSpan.FromSeconds(0.05), DoneAttackingFunc); Animations.Add(attackAnimation); var castingAnimation = new Animation(AnimationTypes.FireAttack, new BodyPart(BodyPartType.Custom, 470, 370)); castingAnimation.AddFrame(7, 0, TimeSpan.FromSeconds(0.15), BecomeInvulnerable); castingAnimation.AddFrame(0, 1, TimeSpan.FromSeconds(0.65)); castingAnimation.AddFrame(7, 0, TimeSpan.FromSeconds(0.15)); castingAnimation.AddFrame(5, 0, TimeSpan.FromSeconds(0.1), CastedFunc); castingAnimation.AddFrame(6, 0, TimeSpan.FromSeconds(0.3)); castingAnimation.AddFrame(5, 0, TimeSpan.FromSeconds(0.15)); castingAnimation.AddFrame(5, 0, TimeSpan.FromSeconds(0.05), DoneAttackingFunc); Animations.Add(castingAnimation); var dieAnimation = new Animation(AnimationTypes.Death, new BodyPart(BodyPartType.Custom, 470, 370)); dieAnimation.AddFrame(6, 2, TimeSpan.FromSeconds(0.1), OnDeath); dieAnimation.AddFrame(7, 2, TimeSpan.FromSeconds(0.1), OnDeathFinished); Animations.Add(dieAnimation); var walkEnragedAnimation = new Animation(AnimationTypes.MoveEnraged, new BodyPart(BodyPartType.Custom, 470, 370)); walkEnragedAnimation.AddFrame(0, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(1, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(2, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(1, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(0, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(3, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(4, 3, TimeSpan.FromSeconds(0.22)); walkEnragedAnimation.AddFrame(3, 3, TimeSpan.FromSeconds(0.22)); Animations.Add(walkEnragedAnimation); var attackEnragedAnimation = new Animation(AnimationTypes.AttackEnraged, new BodyPart(BodyPartType.Custom, 470, 370)); attackEnragedAnimation.AddFrame(1, 4, TimeSpan.FromSeconds(0.04)); attackEnragedAnimation.AddFrame(2, 4, TimeSpan.FromSeconds(0.04)); attackEnragedAnimation.AddFrame(3, 4, TimeSpan.FromSeconds(0.04)); attackEnragedAnimation.AddFrame(4, 4, TimeSpan.FromSeconds(0.04)); attackEnragedAnimation.AddFrame(5, 4, TimeSpan.FromSeconds(0.04), Rotate); attackEnragedAnimation.AddFrame(6, 4, TimeSpan.FromSeconds(0.04), Rotate); attackEnragedAnimation.AddFrame(7, 4, TimeSpan.FromSeconds(0.04), Rotate); attackEnragedAnimation.AddFrame(0, 5, TimeSpan.FromSeconds(0.04), Rotate); attackEnragedAnimation.AddFrame(1, 5, TimeSpan.FromSeconds(0.04), AttackedFunc); attackEnragedAnimation.AddFrame(2, 5, TimeSpan.FromSeconds(0.04), Unrotate); attackEnragedAnimation.AddFrame(3, 5, TimeSpan.FromSeconds(0.04), Unrotate); attackEnragedAnimation.AddFrame(4, 5, TimeSpan.FromSeconds(0.04), Unrotate); attackEnragedAnimation.AddFrame(5, 5, TimeSpan.FromSeconds(0.04), Unrotate); attackEnragedAnimation.AddFrame(5, 5, TimeSpan.FromSeconds(0.04), DoneAttackingFunc); Animations.Add(attackEnragedAnimation); var castingEnragedAnimation = new Animation(AnimationTypes.FireAttackEnraged, new BodyPart(BodyPartType.Custom, 470, 370)); castingEnragedAnimation.AddFrame(7, 3, TimeSpan.FromSeconds(0.12), BecomeInvulnerable); castingEnragedAnimation.AddFrame(0, 4, TimeSpan.FromSeconds(0.25)); castingEnragedAnimation.AddFrame(7, 3, TimeSpan.FromSeconds(0.1)); castingEnragedAnimation.AddFrame(5, 3, TimeSpan.FromSeconds(0.1), CastedFunc); castingEnragedAnimation.AddFrame(6, 3, TimeSpan.FromSeconds(0.2)); castingEnragedAnimation.AddFrame(5, 3, TimeSpan.FromSeconds(0.12)); castingEnragedAnimation.AddFrame(5, 3, TimeSpan.FromSeconds(0.05), DoneAttackingFunc); Animations.Add(castingEnragedAnimation); var dieEnragedAnimation = new Animation(AnimationTypes.DeathEnraged, new BodyPart(BodyPartType.Custom, 470, 370)); dieEnragedAnimation.AddFrame(6, 5, TimeSpan.FromSeconds(0.1), OnDeath); dieEnragedAnimation.AddFrame(7, 5, TimeSpan.FromSeconds(0.1), OnDeathFinished); Animations.Add(dieEnragedAnimation); // Center the boss in the middle of the section X = Globals.Map.GetSection(this).Center.X; Y = Globals.Map.GetSection(this).Center.Y; }
public IceballMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/iceball.png") { Damage = damageInstance; Width = 64; Height = 64; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.IceballDistance; Speed = AbilityConstants.IceballSpeed; Velocity = Creator.Facing.Normalized(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.08)); deathAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.93f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.85f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.78f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.71f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.64f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.58f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.51f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 8, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.46f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 9, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.38f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 10, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.3f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 11, 0, 64, 64), TimeSpan.FromSeconds(0.08), DeathFunc); Animations.Add(deathAnimation); }
public ColdBuff(Being being, TimeSpan length, float factor) : base(null, being, length, true, movementSpeedFactor: factor) { Texture = TextureCacheFactory.Get("Buffs/cold.png"); Animation = new Animation(""); Animation.AddFrame(Texture.Bounds, TimeSpan.FromSeconds(0.15)); }
private AnimationSet InternalLoadAnimationSet(IniFile ini, string fileId) { AnimationSet animationSet = null; string img = ini.ReadString("", "image"); if (!string.IsNullOrEmpty(img)) { Texture tex = engine.GetTexture(img); if (tex != null) { animationSet = new AnimationSet(fileId, tex); int renderSizeX = 0; int renderSizeY = 0; int renderOffsetX = 0; int renderOffsetY = 0; int[] renderSize = ini.ReadString("", "render_size").ToIntValues(); if (renderSize.Length >= 2) { renderSizeX = renderSize[0]; renderSizeY = renderSize[1]; } int[] offsetSize = ini.ReadString("", "render_offset").ToIntValues(); if (offsetSize.Length >= 2) { renderOffsetX = offsetSize[0]; renderOffsetY = offsetSize[1]; } BlendMode blendMode = (BlendMode)ini.ReadInt("", "blend_mode"); byte alphaMod = (byte)ini.ReadInt("", "alpha_mod", 255); Color colorMod = new Color(255, 255, 255); string colorModStr = ini.ReadString("", "color_mod"); if (!string.IsNullOrEmpty(colorModStr)) { colorMod = colorModStr.ToColor(); } foreach (var sec in ini.Sections) { if (!string.IsNullOrEmpty(sec.Name)) { AnimationType type = sec.ReadString("type").ToAnimationType(); Animation anim = animationSet.AddAnimation(sec.Name, type, blendMode, alphaMod, colorMod); int frames = sec.ReadInt("frames"); int duration = sec.ReadString("duration").ToDuration(engine.MaxFramesPerSecond); int position = sec.ReadInt("position"); bool firstFrame = true; bool noFrame = true; foreach (var key in sec.KeyList) { if (key.Ident.Equals("frame")) { if (firstFrame) { anim.Setup(frames, duration); firstFrame = false; } noFrame = false; int[] values = key.Value.ToIntValues(); int index = values[0]; int direction = values[1]; int x = values[2]; int y = values[3]; int w = values[4]; int h = values[5]; int ox = values[6]; int oy = values[7]; anim.AddFrame(index, direction, x, y, w, h, ox, oy); } } if (noFrame && renderSizeX > 0 && renderSizeY > 0) { anim.Setup(frames, duration); anim.SetUncompressed(renderSizeX, renderSizeY, renderOffsetX, renderOffsetY, position, frames, duration); } } } } } return(animationSet); }