Example #1
0
        public override void Execute(float deltaTime)
        {
            // advance to next image
            ImageHolder pImageHolder = (ImageHolder)this.pCurrImage.pSNext;

            // if at end of list, set to first
            if (pImageHolder == null)
            {
                pImageHolder = (ImageHolder)poFirstImage;
            }

            // squirrel away for next timer event
            this.pCurrImage = pImageHolder;

            // change image
            this.pSprite.ChangeImage(pImageHolder.pImage);

            // Add itself back to timer
            TimerEventManager.Add(TimerEvent.Name.SpriteAnimation, this, deltaTime);
        }
        //----------------------------------------------------------------------------------
        // Abstract Methods
        //----------------------------------------------------------------------------------


        public override void Execute(float deltaTime)
        {
            Debug.Assert(deltaTime > 0);

            ImageHolder pImgHold = (ImageHolder)this.pCurrentImage.pNext;

            // if you reached the end go back to the start
            if (pImgHold == null)
            {
                pImgHold = (ImageHolder)this.poFirstImage;
            }

            //set frame to next image
            this.pCurrentImage = pImgHold;

            //set the sprite to the same thing.
            this.pSprite.SwapImage(pImgHold.pImage);

            //Add this event to the Timer
            TimerManager.Add(TimeEvent.Name.SpriteAnimation, this, this.pAlienGrid.movementTimeInterval);
        }
Example #3
0
        public override void Execute(float deltaTime)
        {
            // advance to next image
            ImageHolder pImageHolder = (ImageHolder)this.pCurrImage.pSNext;
            AlienGrid   pAlienGrid   = (AlienGrid)GameObjectManager.Find(GameObject.Name.AlienGrid);

            // if at end of list, set to first
            if (pImageHolder == null)
            {
                pImageHolder = (ImageHolder)poFirstImage;
            }

            // squirrel away for next timer event
            this.pCurrImage = pImageHolder;

            // change image
            this.pSprite.SwapImage(pImageHolder.pImage);

            // Add itself back to timer
            TimerManager.Add(TimeEvent.Name.SpriteAnimation, this, pAlienGrid.GetMoveRate());
        }
Example #4
0
        //when execute() is called it changes images
        public override void Execute(float deltaTime)
        {
            //downcasting and set to next image
            ImageHolder pImageHolder = (ImageHolder)this.pCurrentImage.pSNext;

            // if we are at the end of the list
            //go to the first image and set it
            if (pImageHolder == null)
            {
                pImageHolder = (ImageHolder)this.poFirstImage;
            }

            //update current image
            this.pCurrentImage = pImageHolder;

            //change the image
            this.pSprite.SwapImage(pImageHolder.pImage);

            //"this" is the AnimSprite class that derives from the command class
            //so its the pointer to "this" command
            TimerMan.Add(TimeEvent.Name.AnimateCrab, this, deltaTime);
        }
Example #5
0
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------
        public override void execute(float deltaTime)
        {
            // get next image
            ImageHolder pImageHolder = (ImageHolder)this.pCurrImage.pNext;
            SoundHolder pSoundHolder = (SoundHolder)this.pCurrSound.pNext;

            // if at the end of the list, set first image back
            if (pImageHolder == null)
            {
                pImageHolder = (ImageHolder)this.poFirstImage;
            }

            if (pSoundHolder == null)
            {
                pSoundHolder = (SoundHolder)this.poFirstSound;
            }

            this.pCurrImage = pImageHolder;
            this.pCurrSound = pSoundHolder;

            // change image
            this.pGameSprite.swapImage(pImageHolder.getImage());
            SoundMan.Play(pSoundHolder.getSound());

            // Add itself back to TimerMan
            if (this.pGameSprite.getName() == GameSprite.Name.Squid)
            {
                TimerMan.Add(TimeEvent.Name.SquidAnimation, this, deltaTime);
            }
            else if (this.pGameSprite.getName() == GameSprite.Name.Crab)
            {
                TimerMan.Add(TimeEvent.Name.CrabAnimation, this, deltaTime);
            }
            else if (this.pGameSprite.getName() == GameSprite.Name.Octopus)
            {
                TimerMan.Add(TimeEvent.Name.OctopusAnimation, this, deltaTime);
            }
        }