Пример #1
0
 // Ifs allow for diagonal movement, if-else will prevent diagonal movement
 public override void Update(Vector2 OFFSET)
 {
     spawnTimer.UpdateTimer();
     if (spawnTimer.Test())
     {
         SpawnMob();
         spawnTimer.ResetToZero();
     }
     base.Update(OFFSET);
 }
Пример #2
0
        public override void Update(Vector2 OFFSET, Player ENEMY)
        {
            spawnTimer.UpdateTimer();

            if (spawnTimer.Test())
            {
                SpawnEggSac();
                spawnTimer.ResetToZero();
            }

            base.Update(OFFSET, ENEMY);
        }
Пример #3
0
        public override void Update(Vector2 OFFSET, Player ENEMY)
        {
            shotTimer.UpdateTimer();

            if (shotTimer.Test())
            {
                ShootArrow(ENEMY);
                shotTimer.ResetToZero();
            }

            base.Update(OFFSET);
        }
Пример #4
0
 public virtual void Update(Vector2 OFFSET, List <Unit> UNITS)
 {
     pos += direction * speed;
     if (timer.Test())
     {
         done = true;
     }                                 // makes sure that projectiles do not go on forever
     if (HitSomething(UNITS))
     {
         // This is where we would tell the mob/unit that it is hit and trigger health reduction etc.
         done = true;
     }
 }
Пример #5
0
        public virtual void Update(Vector2 OFFSET, List <AttackableObject> ATTACKABLE_OBJECTS)
        {
            position += direction * speed;

            timer.UpdateTimer();

            if (timer.Test())
            {
                done = true;
            }

            if (HitSomething(ATTACKABLE_OBJECTS))
            {
                done = true;
            }
        }
Пример #6
0
        public void Update()
        {
            if (frames > 1)
            {
                frameTimer.UpdateTimer();
                if (frameTimer.Test() && (maxPasses == 0 || maxPasses > currentPass))
                {
                    currentFrame++;
                    if (currentFrame >= frames)
                    {
                        currentPass++;
                    }
                    if (maxPasses == 0 || maxPasses > currentPass)
                    {
                        sheetFrame.X += 1;

                        if (sheetFrame.X >= sheet.X)
                        {
                            sheetFrame.X  = 0;
                            sheetFrame.Y += 1;
                        }
                        if (currentFrame >= frames)
                        {
                            currentFrame = 0;
                            hasFired     = false;
                            sheetFrame   = new Vector2(startFrame.X, startFrame.Y);
                        }
                    }
                    frameTimer.Reset();
                }
            }

            if (FireAction != null && fireFrame == currentFrame && !hasFired)
            {
                FireAction(null);
                hasFired = true;
            }
        }