public CMenu(string name, Graphics.CSprite image, int displayTime, Sound.CSound BGM = null, Sound.CSound itemSwitch = null, Sound.CSound itemSelect = null) : base() { base.image = image; _displayTime = displayTime; _bgm = BGM; _itemSelect = itemSelect; _itemSwitch = itemSwitch; _position = new Vector2(18, 18); _name = name; if (_bgm != null) CMasterControl.audioPlayer.addSfx(_bgm); }
public CMenu(string name, Graphics.CSprite image, int displayTime, Sound.CSound BGM = null, Sound.CSound itemSwitch = null, Sound.CSound itemSelect = null) : base() { base.image = image; _displayTime = displayTime; _bgm = BGM; _itemSelect = itemSelect; _itemSwitch = itemSwitch; _position = new Vector2(18, 18); _name = name; if (_bgm != null) { CMasterControl.audioPlayer.addSfx(_bgm); } }
public override void update(GameTime gameTime) { base.update(gameTime); switch (_state) { case "Swinging": if (!_swordReleased) { _swordReleased = true; Vector2 swordPos = Vector2.Zero; Random random = new Random(); int attackSound = random.Next(0, 3); Sound.CSound[] temp = new Sound.CSound[4]; temp[0] = CMasterControl.audioPlayer.soundBank["Player:Attack1"]; temp[1] = CMasterControl.audioPlayer.soundBank["Player:Attack2"]; temp[2] = CMasterControl.audioPlayer.soundBank["Player:Attack3"]; temp[3] = CMasterControl.audioPlayer.soundBank["Player:Attack4"]; CMasterControl.audioPlayer.addSfx(temp[attackSound]); CMasterControl.audioPlayer.addSfx(CMasterControl.audioPlayer.soundBank["Player:SwordSlash"]); switch (_direction) { case DIRECTION.UP: swapImage("PlayerSwingUp"); swordPos.X = _position.X - 13; swordPos.Y = _position.Y - 13; break; case DIRECTION.LEFT: swapImage("PlayerSwingLeft"); swordPos.X = _position.X - 18; swordPos.Y = _position.Y - 10; break; case DIRECTION.RIGHT: swapImage("PlayerSwingRight"); swordPos.X = _position.X - 12; swordPos.Y = _position.Y - 10; break; case DIRECTION.DOWN: swapImage("PlayerSwingDown"); swordPos.X = _position.X - 17; swordPos.Y = _position.Y - 13; break; } _triggerUserEvent(0, "sword", _direction.ToString(), swordPos.X.ToString(), swordPos.Y.ToString()); } break; case "Idle": switch (_direction) { case DIRECTION.DOWN: swapImage("PlayerIdleDown", false); break; case DIRECTION.UP: swapImage("PlayerIdleUp", false); break; case DIRECTION.LEFT: swapImage("PlayerIdleLeft", false); break; case DIRECTION.RIGHT: swapImage("PlayerIdleRight", false); break; } break; } _readableCoords = _position; }