Пример #1
0
 public void add(TPillPoint xy)
 {
     head = xy;
     if (fEmpty)
     {
         fTail = xy;
     }
     Add(xy);
     intAdd(xy);
     fEmpty = false;
 }
Пример #2
0
 protected virtual void intAdd(TPillPoint xy)
 {
 }
Пример #3
0
 protected virtual void intClear(TPillPoint xy)
 {
 }
Пример #4
0
 protected virtual void makeFirst(TPillPoint xy)
 {
 }
Пример #5
0
        bool intProcessKey(TTsk keyTsk)
        {
            bool speedOk = true;

            if (lastKeyTurn > 0)
            {
                Double speed;
                if (lastKeyTurn == turn)
                {
                    speed = lastSpeed + lastMomentSpeed;
                }
                else
                {
                    speed           = 1000.0 * 60 / SleepTime / (turn - lastKeyTurn);
                    lastMomentSpeed = speed;
                }
                lastSpeed = speed;
                if (speed > fUserTypeSpeed)
                {
                    userTypeSpeed    = Config.FilterSpeedUp * speed + (1 - Config.FilterSpeedUp) * fUserTypeSpeed;
                    userMinTypeSpeed = Config.FilterAvgSpeedUp * speed + (1 - Config.FilterAvgSpeedUp) * fUserMinTypeSpeed;
                }
                else
                {
                    userTypeSpeed    = Config.FilterSpeedDown * speed + (1 - Config.FilterSpeedDown) * fUserTypeSpeed;
                    userMinTypeSpeed = Config.FilterAvgSpeedDown * speed + (1 - Config.FilterAvgSpeedDown) * fUserMinTypeSpeed;
                }
                speedOk = (speed > userMinTypeSpeed);
            }
            lastKeyTurn = turn;

            UInt16 x, y;

            if (keyTsk.tskNo < 1)
            {
                return(false);
            }
            if (_Pacman == null)
            {
                return(false);
            }
            TPillPoint xy = _Pacman.xyList.head;

            x = xy.x;
            y = xy.y;

            foreach (TXYDir dir in xyDirs)
            {
                dir.x    = x;
                dir.y    = y;
                dir.skip = false;
            }
            int dirCnt = xyDirs.Length;

            do
            {
                foreach (TXYDir xyDir in xyDirs)
                {
                    if (xyDir.skip)
                    {
                        continue;
                    }
                    Labyrinth.translate(ref xyDir.x, ref xyDir.y, xyDir.dir);
                    if (!Labyrinth.outBound(xyDir.x, xyDir.y))
                    {
                        if (CurrentLabyrinth.laby[xyDir.y][xyDir.x] == 0)
                        {
                            foreach (Direction dir in Direction.directions)
                            {
                                if (dir.Opposite == xyDir.dir)
                                {
                                    continue;
                                }
                                if (dir == xyDir.dir)
                                {
                                    continue;
                                }

                                int xx = xyDir.x;
                                int yy = xyDir.y;
                                Labyrinth.translate(ref xx, ref yy, dir);
                                if (chkKey(keyTsk, speedOk, xx, yy))
                                {
                                    return(true);
                                }
                            }
                            continue;
                        }
                        else
                        {
                            if (chkKey(keyTsk, speedOk, xyDir.x, xyDir.y))
                            {
                                double halfSpeed = userMinTypeSpeed / 2;
                                Audio.PlayGoodPill(Math.Max(Math.Min((userTypeSpeed - halfSpeed) / halfSpeed, 1), 0));
                                return(true);
                            }
                        }
                    }
                    dirCnt--;
                    xyDir.skip = true;
                }
            } while (dirCnt > 0);
            taskBox.tskProvider.tskBad(keyTsk);
            if (Audio != null)
            {
                Audio.PlayWrongPill();
            }
            return(false);
        }
Пример #6
0
 public void initHead(TPillPoint value)
 {
     {
         fHead = value;
     }
 }