コード例 #1
0
        public void OnMoveOneStep()
        {
            var nextPoint = Brain.MoveOneStep(TheWorm, Board);

            bool successfulMove = Board.IsValidPoint(nextPoint);

            if (successfulMove)
            {
                var tileState = Board.Get(nextPoint);
                successfulMove = !Board.IsBadPoint(tileState);
            }

            if (!successfulMove)
            {
                Reset();
            }
            else
            {
                //here is where we'll respond to powerups
                //var tileState = Board.Get(nextPoint);
                //tileState == GameTileState.Powerup

                TheWorm.SlitherTo(nextPoint, ref _board);
            }
        }
コード例 #2
0
        public void Reset()
        {
            Board.PauseUpdateEvents();

            Board.ClearAll();

            TheWorm.Reset(StartingLength);

            TheWorm.SlitherTo(new BoardPoint(1, 2), ref _board);
            TheWorm.SlitherTo(new BoardPoint(2, 2), ref _board);

            Board.ResumeUpdateEvents();
        }