Пример #1
0
        public override void Update(GameTime gameTime)
        {
            if (EState != EntityState.DEAD && EState != EntityState.DYING)
            {
                Handler.Handle(this, gameTime);
            }

            this.BoundingBox.X = (int)Position.X;
            this.BoundingBox.Y = (int)Position.Y;

            bool temp = true;

            if (EState != EntityState.DEAD)
            {
                temp = AniManager.UpdateOnce(AState, gameTime);
            }
            if (EState == EntityState.DYING && !temp)
            {
                EState = EntityState.DEAD;
            }

            if (!temp)
            {
                AState = AnimationState.IDLE;
                EState = EntityState.PASSIVE;
            }
        }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            AniManager.UpdateOnce(AState, gameTime);

            GlideAnim.Update(gameTime);

            LootAtTarget();

            // Update position via glie animation position
            switch (GState)
            {
            case GroundState.BOTTOM:
            case GroundState.TOP:
                Position.Y = OPosition.Y + GlideAnim.COffset;
                break;

            case GroundState.RIGHT:
            case GroundState.LEFT:
                Position.X = OPosition.X + GlideAnim.COffset;
                break;

            default: break;
            }

            // If is ready to apper/disapper then relocate
            if (EState == EntityState.PASSIVE)
            {
                Relocate();
            }

            if (EState == EntityState.INVISIBLE && (DateTime.Now - ICooldown).TotalSeconds > IDelayTime)
            {
                // When invisiable and cooldown is gone then set ready to apper
                EState     = EntityState.PASSIVE;
                FadeTarget = true;
            }
            else if (EState == EntityState.ACTIVE && (DateTime.Now - ACooldown).TotalSeconds > ADelayTime)
            {
                // When visiable and cooldown is gone then set ready to disapper
                EState     = EntityState.PASSIVE;
                FadeTarget = false;
            }
            else if (EState == EntityState.ACTIVE && !IsSummoned)
            {
                // Do stuff when appeared and have time till cooldown
                IsSummoned = true;
                Summon();
            }
            else if (EState == EntityState.INVISIBLE)
            {
                // Do stuff when invisiable and have time till cooldown
                IsSummoned = false;
            }
        }
Пример #3
0
        public override void Update(GameTime gameTime)
        {
            Handler.Handle(this, gameTime);

            this.BoundingBox.X = (int)Position.X;
            this.BoundingBox.Y = (int)Position.Y;

            var temp = AniManager.UpdateOnce(AState, gameTime);

            if (EState == EntityState.ACTIVE && !temp)
            {
                EState = EntityState.NONE;
                AState = AnimationState.WALK;
            }
        }
Пример #4
0
        public override void Update(GameTime gameTime)
        {
            bool temp = true;

            if (IsAnimated)
            {
                temp = AniManager.UpdateOnce(MState, gameTime);
            }

            if (IsGlided)
            {
                GlideAnimation.Update(gameTime);
            }

            // make actions depend on magic type
            switch (MState)
            {
            case MagicState.FIST:
                switch (GState)
                {
                case GroundState.BOTTOM:
                case GroundState.TOP:
                    Position.X   += Velocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
                    GPosition.Y   = GlideAnimation.COffset;
                    BoundingBox.Y = (int)Position.Y;
                    BoundingBox.X = (int)Position.X;

                    if (Position.X > WCore.LLimits.Width || Position.X < WCore.LLimits.X)
                    {
                        Kill(this);
                    }
                    break;

                case GroundState.RIGHT:
                case GroundState.LEFT:
                    Position.Y   += Velocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
                    GPosition.X   = GlideAnimation.COffset;
                    BoundingBox.X = (int)Position.X;
                    BoundingBox.Y = (int)Position.Y;

                    if (Position.Y > WCore.LLimits.Height || Position.Y < WCore.LLimits.Y)
                    {
                        Kill(this);
                    }
                    break;

                default: break;
                }
                break;

            case MagicState.DEAD:
                Alpha -= 0.03f;
                if (!temp)
                {
                    Kill(this);
                }
                break;

            case MagicState.PORTAL:
                if (EState == EntityState.NONE && AniManager.CTimeIntoAnimation.TotalSeconds > AniManager.CDuration.TotalSeconds / 2)
                {
                    EState = EntityState.PASSIVE;
                    WCore.AddToSpawnQueue(typeof(Enemy).FullName, Position);
                }
                if (!temp)
                {
                    Kill(this);
                }
                break;

            default:
                if (!temp)
                {
                    Kill(this);
                }
                break;
            }
        }