示例#1
0
        public void GameLose()
        {
            Head = null;
            Food = null;
            var inSecond = 1000f / SleepTime;

            LoseTimer = (int)(inSecond * 3);
        }
示例#2
0
        public void GameWin()
        {
            Head = null;
            Food = null;
            var inSecond = 1000f / SleepTime;

            WinTimer = (int)(inSecond * 3);
        }
示例#3
0
        public void Grow()
        {
            if (Child != null)
            {
                Child.Grow();
                return;
            }

            var piece = new SnakePiece(PreviousX, PreviousY);

            piece.SetParent(this);
        }
示例#4
0
 public void Initialize()
 {
     LoseTimer        = 0;
     WinTimer         = 0;
     Length           = 1;
     WinThreshold     = 30;
     Head             = new SnakePiece(0, 0);
     CurrentDirection = Direction.RIGHT;
     LastDirection    = Direction.RIGHT;
     Random           = new Random();
     SpawnFood();
 }
示例#5
0
 public void SetChild(SnakePiece child)
 {
     Child = child;
 }
示例#6
0
 public void SetParent(SnakePiece parent)
 {
     Parent = parent;
     parent.SetChild(this);
 }