コード例 #1
0
        /// <summary>
        /// Method that is called when a pea finishes jumping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpCompleted(JumpEventArgs e)
        {
            if (_activeState != null)
            {
                _activeState.Exit();
            }

            if (!e.Pea.IsAlive)
            {
                return;
            }

            if (e.Pea.IsTrapped)
            {
                _alert = SpriteAlert.GenerateTrap(this.SceneLayer);
            }
            else if (!e.Pea.IsNotHappy)
            {
                _alert = SpriteAlert.GenerateNinja(this.SceneLayer);
            }

            if (_alert != null)
            {
                _alert.Initialize();

                if (this.ContentManager != null)
                {
                    _alert.LoadContent(this.ContentManager);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Method that is called when pea jumps
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpStarted(JumpEventArgs e)
        {
            // Because the controler is created BEFORE the sprites this works
            if (e.Pea.IsAlive && !e.Pea.IsNotHappy && e.Pea.JumpSpot != null)
            {
                _activeState = new SpriteJumpInfo(this.SceneLayer, _pointsController.ActiveTimes(e.Pea));
                _activeState.Initialize();

                if (this.ContentManager != null)
                {
                    _activeState.LoadContent(this.ContentManager);
                }
            }
        }