Ejemplo n.º 1
0
        public virtual void Update(GameTime gameTime, Vector2 newPOS, LevelManager level)
        {
            timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds;
            int affectedMilliseconds;
            /* use affectedMilliseconds to change the milliseconds per frame (or speed of the mob)
             * when something like a slow spell, or a fast spell is cast.
             */
            if (m_slowed)
                affectedMilliseconds = millisecondsPerFrame * 2;
            else if (m_fast)
                affectedMilliseconds = millisecondsPerFrame / 2;
            else
                affectedMilliseconds = millisecondsPerFrame;

            if (timeSinceLastFrame > affectedMilliseconds)
            {
                timeSinceLastFrame -= affectedMilliseconds;
                SetPosition = newPOS;

                if(BaseMob.m_frozen)
                    m_TimeSinceFrozen += gameTime.ElapsedGameTime.Milliseconds;
                if(BaseMob.m_frozen && (BaseMob.m_TimeSinceFrozen > BaseMob.m_FrozenTimer) )
                {
                    BaseMob.m_frozen = false;
                    BaseMob.m_TimeSinceFrozen = 0;
                }
                if (BaseMob.m_slowed)
                {
                    m_TimeSinceSlowed += gameTime.ElapsedGameTime.Milliseconds;
                }
                if (m_TimeSinceSlowed > m_slowedTimer)
                {
                    BaseMob.m_slowed = false;
                    m_TimeSinceSlowed = 0;
                }
            }
            base.Update(gameTime);
        }
Ejemplo n.º 2
0
 public virtual void OnCollision(LevelManager level)
 {
     if (this.OnCollisionEvent != null)
         this.OnCollisionEvent(this);
 }
Ejemplo n.º 3
0
Archivo: Kroz.cs Proyecto: secgoat/Kroz
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>("BaseFont");
            transparentTexture = Content.Load<Texture2D>("transparent");
            //-----------------------------This is a neat way to have a blank texture to use for whatever
            Texture2D blankTexture = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            //---------------------------------------------------------------------------------------------

            levelManager = new LevelManager(this, spriteBatch);
            Components.Add(levelManager);
            levelManager.Hide();

            //startScreen = new StartScreen(this, spriteBatch, spriteFont, Content.Load<Texture2D>("alienmetal"));
            startScreen = new StartScreen(this, spriteBatch, spriteFont, blankTexture);
            Components.Add(startScreen);
            startScreen.Hide();

               levelSelectScreen = new LevelSelectScreen(this, spriteBatch, spriteFont, transparentTexture );
            Components.Add(levelSelectScreen);
            levelSelectScreen.Hide();

            pitFallScreen = new PitFallScreen(this, spriteBatch, spriteFont, blankTexture);
            Components.Add(pitFallScreen);
            pitFallScreen.Hide();

            activeScreen = startScreen;
            activeScreen.Show();

            IsMouseVisible = true;

            levelSelectScreen.Exit.onClick += new EHandler(HandleSelectLevelScreen);
            levelSelectScreen.Load.onClick += new EHandler(HandleSelectLevelScreen);

            levelManager.PitFall += new LevelManager.PitEvent(StartPitFallScreen);
        }