All pastes #126703 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-08-11 18:26 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;

using FRB;
using FRB.GUI;
using FRB.Text;
using FRB.Audio;

using Microsoft.DirectX.DirectInput;

namespace SadSoft.Games.Battleship.Screens
{

    class PlayScreen : Screens.Screen
    {
        private enum State
        {
            PlacingShips,
            Ready,
            WaitingForTurn,
            InTurn
        }

        private State _currentState = State.PlacingShips;
        private Gameboard _boardMine;
        private Ship _shipBeingPlaced;

        public PlayScreen(Screens.FrbEngineReferences frbEngineReferences):
            base("scnFiles/gameBoard.scn", "", frbEngineReferences)
        {
            
        }


        public override void Activity()
        {
            base.Activity();

            switch (_currentState)
            {
                case State.PlacingShips:
                    PlaceShips();
                    break;
                case State.Ready:
                    break;
                case State.WaitingForTurn:
                    break;
                case State.InTurn:
                    break;
                default:
                    break;
            }   
        }

        public void PlaceShips()
        {
            if (_boardMine == null)
            {
                _boardMine = new Gameboard();
                _boardMine.MyShips = new List<Ship>(5);

                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Carrier));
                /*
                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Destroyer));
                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Cruiser));
                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Battleship));
                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Sub));
                _boardMine.MyShips.Add(new Ship(Ship.ShipType.Boat));
                */
            }
            if (_shipBeingPlaced == null)
            {
                foreach (Ship ship in _boardMine.MyShips)
                {
                    if (ship.Placed == false)
                    {
                        _shipBeingPlaced = ship;
                    }
                }                
            }

            Sprite test = base.mSpriteGrids[0].FindSpriteAt(
                 cursor.XAt(0), 
                 cursor.YAt(0),
                 0);

            if (test != null)
            {
                Console.WriteLine(DateTime.Now.ToString() + "----" + test.x.ToString());
            }
            else
            Console.WriteLine(DateTime.Now.ToString());
        }

        public override void Destroy()
        {
            base.Destroy();
        }

    }
}