using System; using System.Collections.Generic; using System.Text; namespace Sprint2_actual.StateFiles { class LinkStateDownMoving : ILinkState { private Link link; public LinkStateDownMoving(Link link) { this.link = link; this.link.linkSprite = new LinkSpriteDownWalking(link); } public void Update() { link.linkY += (int) GlobalVars.gameTime.ElapsedGameTime.TotalMilliseconds / 5; } public void TakeDamage() { link.game.Player = new DamagedLink(link); //TO-DO: How does game get in here? Is there any alternative to passing game? } public void MoveLeft() { link.state = new LinkStateLeftMoving(link); } public void MoveRight() { link.state = new LinkStateRightMoving(link); } public void MoveUp() { link.state = new LinkStateUpMoving(link); } public void MoveDown() { //NO-OP //Already moving down } public void Idle() { link.state = new LinkStateDownIdle(link); //this is how a moving sprite returns to its idle state when all keys are let go } public void Attack() { link.state = new LinkStateDownAttack(link); } public void UseItem() { link.state = new LinkStateDownUseItem(link); //should item type be made here? if not, we need to make a Use____() for each item and state for each item link could use. //May be more practical to do the latter, but latter would make it so we do not have to change our interfaces later } } }