public StoryboardInformation(Screen screen, Texture2D texture, string text, Vector2 textPosition, bool isTransitionAutomatic, int automaticTransitionDelay) { this.sceneTexture = texture; this.sceneText = text; this.sceneTextPosition = textPosition; this.isTransitionAutomatic = isTransitionAutomatic; isTimerStarted = false; if (isTransitionAutomatic) { timer = new Timer(screen, automaticTransitionDelay); timer.TimeHasElapsed += new EventHandler<EventArgs>(timer_TimeHasElapsed); } }
internal EBossJumpState(Screen parentScreen, EBoss boss) : base(boss) { jumpTimer = new Timer(parentScreen, DELAY_BETWEEN_JUMP_DECISION); jumpTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpTimer_TimeHasElapsed); fallThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_DOWN); fallThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(fallThroughTimer_TimeHasElapsed); jumpThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_UP); jumpThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpThroughTimer_TimeHasElapsed); lastJumpPosition = new Vector2(); }
internal EBossShootState(EBoss boss, Screen parentScreen) : base(boss) { //gunShot = ScreenManager.Instance.Content.Load<SoundEffect>("System\\Sounds\\mgkidShot"); shootTimer = new Timer(parentScreen, 3000); shootTimer.TimeHasElapsed += new EventHandler<EventArgs>(shootTimer_TimeHasElapsed); delayBetweenBullet = new Timer(parentScreen, 50); delayBetweenBullet.TimeHasElapsed += new EventHandler<EventArgs>(delayBetweenBullet_TimeHasElapsed); laughTimer = new Timer(parentScreen, 3000); laughTimer.TimeHasElapsed += new EventHandler<EventArgs>(laughTimer_TimeHasElapsed); isReadyToShoot = true; hasTimerStarted = false; currentBulletCount = 0; }
private void CreateStoryboardFromXML(string assetPath) { XDocument xdoc = ScreenManager.Instance.Content.Load<XDocument>(assetPath); storyboardSong = ScreenManager.Instance.Content.Load<Song>(xdoc.Root.Attribute("Song").Value); font = ScreenManager.Instance.Content.Load<SpriteFont>(xdoc.Root.Attribute("Font").Value); int delayBetweenEachCharacter = Int32.Parse(xdoc.Root.Attribute("DelayBetweenEachCharacter").Value); characterTimer = new Timer(this, delayBetweenEachCharacter); IEnumerable<XElement> boards = xdoc.Descendants("Storyboard"); foreach (XElement board in boards) { Texture2D sceneTexture = ScreenManager.Instance.Content.Load<Texture2D>(board.Attribute("SceneTexture").Value); string sceneText = board.Attribute("SceneText").Value; bool isTransitionAutomatic = Boolean.Parse(board.Attribute("IsTransitionAutomatic").Value); int automaticTransitionDelay = Int32.Parse(board.Attribute("AutomaticTransitionDelay").Value); float textPositionX = Single.Parse(board.Attribute("SceneTextPositionX").Value); float textPositionY = Single.Parse(board.Attribute("SceneTextPositionY").Value); Vector2 textPosition = new Vector2(textPositionX, textPositionY); StoryboardInformation si = new StoryboardInformation(this, sceneTexture, sceneText, textPosition, isTransitionAutomatic, automaticTransitionDelay); this.storyboards.AddLast(si); } }