Exemplo n.º 1
0
 public virtual void Tick(LTimerContext time)
 {
     if (timer.Action(time))
     {
         Run(time);
     }
 }
Exemplo n.º 2
0
 public override void Update(long elapsedTime)
 {
     if (timer.Action(elapsedTime))
     {
         this.IterateFrame();
     }
 }
Exemplo n.º 3
0
        public override void Update(long elapsedTime)
        {
            if (stop)
            {
                return;
            }
            if (timer.Action(elapsedTime))
            {
                switch (code)
                {
                case Config.DOWN:
                case Config.TDOWN:
                case Config.UP:
                case Config.TUP:
                    this.backgroundLoop = ((backgroundLoop + count) % height);
                    break;

                case Config.LEFT:
                case Config.RIGHT:
                case Config.TLEFT:
                case Config.TRIGHT:
                    this.backgroundLoop = ((backgroundLoop + count) % width);
                    break;
                }
            }
        }
Exemplo n.º 4
0
 public override void Update(long elapsedTime)
 {
     if (visible && timer.Action(elapsedTime))
     {
         for (int i = 0; i < count; i++)
         {
             kernels[i].Update();
         }
     }
 }
Exemplo n.º 5
0
 public override void Update(long elapsedTime)
 {
     if (complete)
     {
         return;
     }
     if (this.count > this.maxcount)
     {
         this.complete = true;
     }
     if (timer.Action(elapsedTime))
     {
         count++;
     }
 }
Exemplo n.º 6
0
 public override void Update(long elapsedTime)
 {
     if (timer.Action(elapsedTime))
     {
         if (isAnimation)
         {
             if (animation != null)
             {
                 animation.Update(elapsedTime);
                 SetImage(animation.GetSpriteImage());
             }
         }
         lock (typeof(LLayer)) {
             Action(elapsedTime);
         }
     }
 }
Exemplo n.º 7
0
 public override void Update(long elapsedTime)
 {
     if (timer.Action(elapsedTime))
     {
         for (int i = 0; i < drops.Length; ++i)
         {
             drops[i].xspeed += xSpeed;
             drops[i].yspeed += ySpeed;
             drops[i].x      -= drops[i].xspeed;
             drops[i].y      += drops[i].yspeed;
         }
         step++;
         if (step > limit)
         {
             this.visible = false;
         }
     }
 }
Exemplo n.º 8
0
        public override void Update(long elapsedTime)
        {
            if (!complete)
            {
                if (timer.Action(elapsedTime))
                {
                    switch (direction)
                    {
                    case Config.LEFT:
                    case Config.RIGHT:
                    case Config.TLEFT:
                    case Config.TRIGHT:
                        v1.Move_multiples(Config.TLEFT, multiples);
                        v2.Move_multiples(Config.TRIGHT, multiples);
                        break;

                    case Config.UP:
                    case Config.DOWN:
                    case Config.TUP:
                    case Config.TDOWN:
                        v1.Move_multiples(Config.TUP, multiples);
                        v2.Move_multiples(Config.TDOWN, multiples);
                        break;
                    }

                    if (special)
                    {
                        if (!limit.Intersects(v1.x, v1.y, halfHeight, halfWidth) &&
                            !limit.Intersects(v2.x, v2.y, halfHeight,
                                              halfWidth))
                        {
                            this.complete = true;
                        }
                    }
                    else if (!limit.Intersects(v1.x, v1.y, halfWidth, halfHeight) &&
                             !limit.Intersects(v2.x, v2.y, halfWidth, halfHeight))
                    {
                        this.complete = true;
                    }
                }
            }
        }
Exemplo n.º 9
0
 private void PlayAutoNext()
 {
     if (!autoTimer.Action(elapsedTime))
     {
         return;
     }
     if (scrCG.sleep != 0)
     {
         return;
     }
     if (isSelectMessage)
     {
         return;
     }
     if (message.IsVisible() && !message.IsComplete())
     {
         return;
     }
     NextScript();
 }
Exemplo n.º 10
0
 public override void Update(long elapsedTime)
 {
     if (!visible)
     {
         return;
     }
     base.Update(elapsedTime);
     if (isAutoAlpha && buoyage != null)
     {
         if (delay.Action(elapsedTime))
         {
             if (autoAlpha < 0.95F)
             {
                 autoAlpha += 0.05F;
             }
             else
             {
                 autoAlpha = 0.25F;
             }
         }
     }
 }
Exemplo n.º 11
0
 public void Update(long elapsedTime)
 {
     if (timer.Action(elapsedTime))
     {
         if (flag)
         {
             startTime -= 2;
             if (startTime <= 50)
             {
                 flag = false;
             }
         }
         else
         {
             startTime += 2;
             if (startTime >= 250)
             {
                 flag = true;
             }
         }
     }
 }
Exemplo n.º 12
0
 public override void Update(long elapsedTime)
 {
     if (!visible)
     {
         return;
     }
     if (cycle != null)
     {
         if (cycle.X() != X() || cycle.Y() != Y())
         {
             cycle.SetLocation(X(), Y());
         }
         cycle.Update(elapsedTime);
     }
     else
     {
         if (delay.Action(elapsedTime))
         {
             wait.Next();
         }
     }
 }
Exemplo n.º 13
0
 public void Step(long elapsedTime)
 {
     if (original == null)
     {
         return;
     }
     if (timer.Action(elapsedTime))
     {
         if (firstTick)
         {
             this.firstTick = false;
             this.timer.Refresh();
         }
         else
         {
             Update(elapsedTime);
         }
         if (actionListener != null)
         {
             actionListener.Process(original);
         }
     }
 }
Exemplo n.º 14
0
 public override void Update(long elapsedTime)
 {
     if (visible)
     {
         base.Update(elapsedTime);
         if (timer.Action(this.elapsedTime = elapsedTime))
         {
             Action(elapsedTime);
             if (!isVSync)
             {
                 IIterator it = objects.NewIterator();
                 for (; it.HasNext();)
                 {
                     thing = (Actor)it.Next();
                     if (!thing.visible)
                     {
                         continue;
                     }
                     thing.Update(elapsedTime);
                 }
             }
         }
     }
 }
Exemplo n.º 15
0
        public void Draw(GLEx gl, long elapsed)
        {
            if (logo == null || finish)
            {
                return;
            }
            if (!logo.isLoaded)
            {
                this.logo.LoadTexture();
                this.centerX = (int)(LSystem.screenRect.width * LSystem.scaleWidth) / 2 - logo.Width / 2;
                this.centerY = (int)(LSystem.screenRect.height * LSystem.scaleHeight) / 2 - logo.Height / 2;
            }
            if (logo == null || !logo.isLoaded)
            {
                finish = true;
                return;
            }
            lock (logo)
            {
                gl.Clear();
                color.A = (byte)(255 * alpha);
                gl.DrawTexture(logo, centerX, centerY, color);
            }
            switch (type)
            {
            case 0:
                if (alpha >= 1f)
                {
                    alpha = 1f;
                    type  = 1;
                }
                if (alpha < 1.0f)
                {
                    if (timer.Action(elapsed))
                    {
                        alpha += 0.015f;
                    }
                }
                break;

            case 1:
                if (timer.Action(elapsed))
                {
                    alpha = 1f;
                    type  = 2;
                }
                break;

            case 2:
                if (alpha > 0.0f)
                {
                    if (timer.Action(elapsed))
                    {
                        alpha -= 0.015f;
                    }
                }
                else if (alpha <= 0f)
                {
                    alpha  = 0;
                    type   = 3;
                    finish = true;
                    if (logo != null)
                    {
                        logo.Destroy();
                        logo = null;
                    }
                    return;
                }
                break;
            }
        }
Exemplo n.º 16
0
        public override void Update(long elapsedTime)
        {
            if (timer.Action(elapsedTime))
            {
                isMoving = MoveState();

                if (tiles == null || findPath == null)
                {
                    return;
                }
                if (IsComplete())
                {
                    return;
                }

                lock (findPath)
                {
                    if (endX == startX && endY == startY)
                    {
                        if (findPath != null)
                        {
                            if (findPath.Count > 1)
                            {
                                Vector2f moveStart = findPath[0];
                                Vector2f moveEnd   = findPath[1];
                                startX    = tiles.TilesToPixelsX(moveStart.X());
                                startY    = tiles.TilesToPixelsY(moveStart.Y());
                                endX      = moveEnd.X() * tiles.GetTileWidth();
                                endY      = moveEnd.Y() * tiles.GetTileHeight();
                                moveX     = moveEnd.X() - moveStart.X();
                                moveY     = moveEnd.Y() - moveStart.Y();
                                direction = Field2D.GetDirection(moveX, moveY);
                                findPath.RemoveAt(0);
                            }
                            else
                            {
                                findPath.Clear();
                            }
                        }
                    }
                    switch (direction)
                    {
                    case Field2D.TUP:
                        startY -= speed;
                        if (startY < endY)
                        {
                            startY = endY;
                        }
                        break;

                    case Field2D.TDOWN:
                        startY += speed;
                        if (startY > endY)
                        {
                            startY = endY;
                        }
                        break;

                    case Field2D.TLEFT:
                        startX -= speed;
                        if (startX < endX)
                        {
                            startX = endX;
                        }
                        break;

                    case Field2D.TRIGHT:
                        startX += speed;
                        if (startX > endX)
                        {
                            startX = endX;
                        }
                        break;

                    case Field2D.UP:
                        startX += speed;
                        startY -= speed;
                        if (startX > endX)
                        {
                            startX = endX;
                        }
                        if (startY < endY)
                        {
                            startY = endY;
                        }
                        break;

                    case Field2D.DOWN:
                        startX -= speed;
                        startY += speed;
                        if (startX < endX)
                        {
                            startX = endX;
                        }
                        if (startY > endY)
                        {
                            startY = endY;
                        }
                        break;

                    case Field2D.LEFT:
                        startX -= speed;
                        startY -= speed;
                        if (startX < endX)
                        {
                            startX = endX;
                        }
                        if (startY < endY)
                        {
                            startY = endY;
                        }
                        break;

                    case Field2D.RIGHT:
                        startX += speed;
                        startY += speed;
                        if (startX > endX)
                        {
                            startX = endX;
                        }
                        if (startY > endY)
                        {
                            startY = endY;
                        }
                        break;
                    }

                    Vector2f tile = tiles.GetTileCollision(this, startX, startY);

                    if (tile != null)
                    {
                        int sx = tiles.TilesToPixelsX(tile.x);
                        int sy = tiles.TilesToPixelsY(tile.y);
                        if (sx > 0)
                        {
                            sx = sx - GetWidth();
                        }
                        else if (sx < 0)
                        {
                            sx = tiles.TilesToPixelsX(tile.x);
                        }
                        if (sy > 0)
                        {
                            sy = sy - GetHeight();
                        }
                        else if (sy < 0)
                        {
                            sy = tiles.TilesToPixelsY(tile.y);
                        }
                    }
                    else
                    {
                        SetLocation(startX, startY);
                    }
                }
            }
        }
Exemplo n.º 17
0
        public override void Alter(LTimerContext t)
        {
            if (IsWait())
            {
                return;
            }
            if (timer1 == null)
            {
                timer1 = new LTimer(50);
            }
            if (title != null && timer1.Action(t.GetTimeSinceLastUpdate()))
            {
                if (title.GetY() > 50)
                {
                    title.Move_up(8);
                    title.ValidatePosition();
                }
                else if (title.GetAlpha() > 0.2f)
                {
                    title.SetAlpha(title.GetAlpha() - 0.1f);
                }
                else
                {
                    title.SetVisible(false);
                    Remove(title);
                    title = null;
                }
                return;
            }
            else if (over != null && timer1.Action(t.GetTimeSinceLastUpdate()) &&
                     !overFlag)
            {
                if (over.GetY() < (GetHeight() - over.GetHeight()) / 2)
                {
                    over.Move_down(8);
                    over.ValidatePosition();
                }
                else if (over.GetAlpha() < 1.0f)
                {
                    over.SetAlpha(over.GetAlpha() + 0.1f);
                }
                else
                {
                    CenterOn(over);
                    overFlag = true;
                }

                return;
            }
            if (!wingame)
            {
                if (timer == null)
                {
                    timer = new LTimer(100);
                }
                if (timer.Action(t.GetTimeSinceLastUpdate()))
                {
                    if (progress != null)
                    {
                        progress.SetUpdate(progress.GetValue() - (stageNo * 30));
                        if (progress.GetValue() <= 100 && !failgame)
                        {
                            failgame = true;
                            GetSprites().SetVisible(false);

                            over       = new LPaper(GetImage(16), 0, 0);
                            over.Click = new OverClick();
                            over.SetAlpha(0.1f);
                            CenterOn(over);
                            over.SetY(0);
                            Add(over);
                        }
                    }
                }
            }
            else
            {
                wingame = false;
                RemoveAll();
                Stage(stageNo + 1);
            }
        }