コード例 #1
0
    private void MoveShot()
    {
        QRegion region = new QRegion(ShotRect());

        timerCount++;

        QRect shotR = ShotRect();

        if (shotR.Intersects(TargetRect()))
        {
            autoShootTimer.Stop();
            Emit.Hit();
            Emit.CanShoot(true);
        }
        else if (shotR.X() > Width() || shotR.Y() > Height() ||
                 shotR.Intersects(BarrierRect()))
        {
            autoShootTimer.Stop();
            Emit.Missed();
            Emit.CanShoot(true);
        }
        else
        {
            region = region.Unite(shotR);
        }

        Update(region);
    }
コード例 #2
0
    private void moveShot()
    {
        QRegion region = new QRegion(shotRect());

        timerCount++;

        QRect shotR = shotRect();

        if (shotR.Intersects(targetRect()))
        {
            autoShootTimer.Stop();
            Emit.hit();
            Emit.canShoot(true);
        }
        else if (shotR.X() > Width() || shotR.Y() > Height())
        {
            autoShootTimer.Stop();
            Emit.missed();
            Emit.canShoot(true);
        }
        else
        {
            region = region.Unite(new QRegion(shotR));
        }

        Update(region);
    }
コード例 #3
0
    private void moveShot()
    {
        QRegion region = new QRegion(shotRect());

        timerCount++;

        QRect shotR = shotRect();

        if (shotR.X() > Width() || shotR.Y() > Height())
        {
            autoShootTimer.Stop();
        }
        else
        {
            region = region.Unite(new QRegion(shotR));
        }
        Update(region);
    }
コード例 #4
0
    public void SetAngle(int angle)
    {
        if (angle < 5)
        {
            angle = 5;
        }
        if (angle > 70)
        {
            angle = 70;
        }
        if (currentAngle == angle)
        {
            return;
        }
        currentAngle = angle;
        QRect cr = CannonRect;

        Update(cr.X(),cr.Y(),cr.Width(),cr.Height());
        Emit.AngleChanged(currentAngle);
    }