Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpSpotCompleted(object sender, EventArgs e)
        {
            var spot = sender as DataJumpSpot;

            _jumpSpotAlert = SpriteAlert.GenerateCompleted(this.SceneLayer);

            _jumpSpotAlert.Initialize();
            _jumpSpotAlert.LoadContent(this.ContentManager);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpSpotMarked(object sender, EventArgs e)
        {
            var spot = sender as DataJumpSpot;

            if (_jumpSpotAlert == null)
            {
                _jumpSpotAlert = SpriteAlert.GenerateJumpSpot(this.SceneLayer);

                _jumpSpotAlert.Initialize();
                _jumpSpotAlert.LoadContent(this.ContentManager);
                _jumpSpotAlert.OnFinished += new EventHandler(_jumpSpotAlert_OnFinished);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Frame Renewal
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            base.Position = _source.Position;
            this.Rotation = _source.Rotation;

            if (_source.IsAlive == false)
            {
                if (_source.IsDying)
                {
                    this.Color = Color.Lerp(this.Color, Color.Transparent, (Single)gameTime.ElapsedGameTime.TotalSeconds * 15);
                }
                else
                {
                    this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5);
                }

                this.Rotation = 0; // (Single)MathHelper.Lerp(this.Rotation, 0, (Single)gameTime.ElapsedGameTime.TotalSeconds * 10);
            }
            else
            {
                this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5);
            }

            // TODO rotation smoothing
            //var degrees = Math.Round(this.Rotation * 180 / Math.PI, 1);
            //this.Rotation = (Single)(degrees * Math.PI / 180);

            if (_alert != null)
            {
                _alert.Update(gameTime);
                _alert.Position = this.Position;

                if (_alert.Enabled == false)
                {
                    _alert = null;
                }
            }

            if (_activeState != null)
            {
                _activeState.Update(gameTime);
                _activeState.Position = this.Position;
                _activeState.Visible  = true; //Settings.Get.ShowJumpInfo;

                if (_activeState.Enabled == false)
                {
                    _activeState = null;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        private void _source_OnStateChanged(Logic.BlockStateArgs args)
        {
            // Update graphic
            if (this.DisplayingType != args.Block.BlockType)
            {
                _jumpSpotAlert = null;

                SetAssetNames();
                LoadContent(this.ContentManager);
            }

            if (args.State == Data.BlockState.Removing)
            {
                _jumpSpotAlert = null;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Loads all content
        /// </summary>
        /// <param name="manager"></param>
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager manager)
        {
            this.ContentManager = manager;

            _jumpSpotAlert = null;

            if (this.DisplayingType == BlockType.None || this.DisplayingType == BlockType.Delete)
            {
                return;
            }

            base.LoadContent(manager);

            // Duplicates are shared in memory per GameScreen
            _shadowTexture       = this.ContentManager.Load <Texture2D>("Graphics/Block-Shadow");
            _intermediateTexture = this.ContentManager.Load <Texture2D>(_intermediateTextureName);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        private void _source_OnStateChanged(Logic.BlockStateArgs args)
        {
            // Update graphic
            if (this.DisplayingType != args.Block.BlockType)
            {
                _jumpSpotAlert = null;

                SetAssetNames();
                LoadContent(this.ContentManager);
            }

            if (args.State == Data.BlockState.Removing)
                _jumpSpotAlert = null;

        }
Ejemplo n.º 8
0
        /// <summary>
        /// Loads all content
        /// </summary>
        /// <param name="manager"></param>
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager manager)
        {
            this.ContentManager = manager;

            _jumpSpotAlert = null;

            if (this.DisplayingType == BlockType.None || this.DisplayingType == BlockType.Delete)
                return;

            base.LoadContent(manager);

            // Duplicates are shared in memory per GameScreen
            _shadowTexture = this.ContentManager.Load<Texture2D>("Graphics/Block-Shadow");
            _intermediateTexture = this.ContentManager.Load<Texture2D>(_intermediateTextureName);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpSpotCompleted(object sender, EventArgs e)
        {
            var spot = sender as DataJumpSpot;

            _jumpSpotAlert = SpriteAlert.GenerateCompleted(this.SceneLayer);

            _jumpSpotAlert.Initialize();
            _jumpSpotAlert.LoadContent(this.ContentManager);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _source_OnJumpSpotMarked(object sender, EventArgs e)
        {
            var spot = sender as DataJumpSpot;

            if (_jumpSpotAlert == null)
            {
                _jumpSpotAlert = SpriteAlert.GenerateJumpSpot(this.SceneLayer);

                _jumpSpotAlert.Initialize();
                _jumpSpotAlert.LoadContent(this.ContentManager);
                _jumpSpotAlert.OnFinished += new EventHandler(_jumpSpotAlert_OnFinished);
            }
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Frame Renewal
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            base.Position = _source.Position;
            this.Rotation = _source.Rotation;

            if (_source.IsAlive == false)
            {
                if (_source.IsDying)
                    this.Color = Color.Lerp(this.Color, Color.Transparent, (Single)gameTime.ElapsedGameTime.TotalSeconds * 15);
                else
                    this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5);

                this.Rotation = 0; // (Single)MathHelper.Lerp(this.Rotation, 0, (Single)gameTime.ElapsedGameTime.TotalSeconds * 10);
            }
            else
            {
                this.Color = Color.Lerp(this.Color, Color.White, (Single)gameTime.ElapsedGameTime.TotalSeconds * 5);
            }

            // TODO rotation smoothing
            //var degrees = Math.Round(this.Rotation * 180 / Math.PI, 1);
            //this.Rotation = (Single)(degrees * Math.PI / 180);

            if (_alert != null)
            {
                _alert.Update(gameTime);
                _alert.Position = this.Position;

                if (_alert.Enabled == false)
                    _alert = null;
            }

            if (_activeState != null)
            {
                _activeState.Update(gameTime);
                _activeState.Position = this.Position;
                _activeState.Visible = true; //Settings.Get.ShowJumpInfo;

                if (_activeState.Enabled == false)
                    _activeState = null;
            }
        }