/// <summary> /// Begins or continues playback of an animation. /// </summary> public void PlayAnimation(Animation animation) { // If this animation is already running, do not restart it. if (this.animation == animation) return; // Start the new animation. this.animation = animation; this.frameIndex = 0; this.time = 0.0f; }
public LayerEnemy(ContentManager content) : base(content) { level = content.ServiceProvider.GetService(typeof(Level)) as Level; enemyRunRed = new Animation(content.Load<Texture2D>("Sprites/MonsterA/RunEnemy"), 0.1f, true); enemyIdleRed = new Animation(content.Load<Texture2D>("Sprites/MonsterA/Idle"), 0.15f, true); electr = new Animation(content.Load<Texture2D>("Sprites/fulmine"), 0.15f, true,32); bladeRun = new Animation(content.Load<Texture2D>("Sprites/Guill"), 0.1f, true); thorns = new Animation(content.Load<Texture2D>("Sprites/Thorns"), 0.1f, true); Initialize(); }
public LayerPlayer(ContentManager content) : base(content) { level = content.ServiceProvider.GetService(typeof(Level)) as Level; playerIdle = new Animation(content.Load<Texture2D>("Sprites/Player/Idle"), 0.1f, true); playerRun = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.03f, true); playerWalk = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.07f, true); playerJump = new Animation(content.Load<Texture2D>("Sprites/Player/jumpPlayer"), 0.1f, false); playerWin = new Animation(content.Load<Texture2D>("Sprites/Player/player"), 0.1f, false); playerDie = new Animation(content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false); //set default animation sprite level.playerLevel.sprite.PlayAnimation(playerIdle); }
public LayerGameObject(ContentManager content) { level = content.ServiceProvider.GetService(typeof(Level)) as Level; portal = new Animation(content.Load<Texture2D>("Sprites/portal"), 0.32f, true); doorClose = new Animation(content.Load<Texture2D>("Sprites/doorClose"), 0.1f, false); pass1 = new Animation(content.Load<Texture2D>("Sprites/pass1"), 0.1f, false); passClose1 = new Animation(content.Load<Texture2D>("Sprites/passClose1"), 0.1f, false); pass2 = new Animation(content.Load<Texture2D>("Sprites/pass2"), 0.1f, false); passClose2 = new Animation(content.Load<Texture2D>("Sprites/passClose2"), 0.1f, false); pass3 = new Animation(content.Load<Texture2D>("Sprites/pass3"), 0.1f, false); passClose3 = new Animation(content.Load<Texture2D>("Sprites/passClose3"), 0.1f, false); openDoor = new Animation(content.Load<Texture2D>("Sprites/Player/Die"), 0.1f, false); handle1 = new Animation(content.Load<Texture2D>("Sprites/handle1"), 0.1f, false); handle2 = new Animation(content.Load<Texture2D>("Sprites/handle2"), 0.1f, false); handle3 = new Animation(content.Load<Texture2D>("Sprites/handle3"), 0.1f, false); Initialize(); }
/// <summary> /// Begins or continues playback of an animation. /// </summary> public void ResetAnimation(Animation animation) { // Start the new animation. this.animation = animation; this.frameIndex = 0; this.time = 0.0f; }