Start() 개인적인 메소드

private Start ( ) : void
리턴 void
예제 #1
0
    public void Setup(bool same)
    {
        if (!same)  //If new map
        {
            map = new GameMap();
            map.Start();
        }
        endGame = false;    //setup
        wump = new Wumpus();
        player = new Player();
        bats = new Bat();

        wump.room = map.getWump();
        player.room = map.getCurrent();
        int[] temp = map.getAdjacent(player.room);
        doors[0] = GameObject.Find("Left Door");
        doors[1] = GameObject.Find("Middle Door");
        doors[2] = GameObject.Find("Right Door");
        for (int i = 0; i < 3; i++)
        {
            doors[i].GetComponent<Door>().doorNum = temp[i];
        }
        bats.room = map.getBat();
        currentNum.text = "Current Room: " + player.room;
        //GameObject[] doors = FindObjectsOfType(typeof(Door)) as GameObject[];
        for (int i = 0; i < 20; i++)
        {
            rooms[i] = GameObject.Find("/Rooms/Room (" + i + ")");
        }
        Warnings(); //check for initial warnings
    }
예제 #2
0
    public void Setup(bool same)
    {
        if (!same)  //If new map
        {
            map = new GameMap();
            map.Start();
        }
        endGame = false;    //setup
        wump    = new Wumpus();
        player  = new Player();
        bats    = new Bat();

        wump.room   = map.getWump();
        player.room = map.getCurrent();
        int[] temp = map.getAdjacent(player.room);
        doors[0] = GameObject.Find("Left Door");
        doors[1] = GameObject.Find("Middle Door");
        doors[2] = GameObject.Find("Right Door");
        for (int i = 0; i < 3; i++)
        {
            doors[i].GetComponent <Door>().doorNum = temp[i];
        }
        bats.room       = map.getBat();
        currentNum.text = "Current Room: " + player.room;
        //GameObject[] doors = FindObjectsOfType(typeof(Door)) as GameObject[];
        for (int i = 0; i < 20; i++)
        {
            rooms[i] = GameObject.Find("/Rooms/Room (" + i + ")");
        }
        Warnings(); //check for initial warnings
    }
예제 #3
0
    public void Start()
    {
        NetworkMsg msg = new ReplyStart(true);

        gameMap.Start(players);
        roomBroadCast(msg);
        bStart = true;
        //  preTimer.Start();
    }
예제 #4
0
    public void Setup(bool same)
    {
        if (!same)  //If new map
        {
            map = new GameMap();
            map.Start();
        }
        endGame = false;    //setup
        wump = new Wumpus();
        player = new Player();
        bats = new Bat();

        wump.room = map.getWump();
        player.room = map.getCurrent();
        bats.room = map.getBat();
        for (int i = 0; i < 20; i++)
        {
            rooms[i] = GameObject.Find("Room (" + i + ")");
            rooms[i].GetComponent<Room>().player = false;
        }
        Warnings(); //check for initial warnings
        rooms[player.room].GetComponent<Room>().player = true;     //show player room
    }
예제 #5
0
    public void Setup(bool same)
    {
        if (!same)  //If new map
        {
            map = new GameMap();
            map.Start();
        }
        endGame = false;    //setup
        wump    = new Wumpus();
        player  = new Player();
        bats    = new Bat();

        wump.room   = map.getWump();
        player.room = map.getCurrent();
        bats.room   = map.getBat();
        for (int i = 0; i < 20; i++)
        {
            rooms[i] = GameObject.Find("Room (" + i + ")");
            rooms[i].GetComponent <Room>().player = false;
        }
        Warnings();                                             //check for initial warnings
        rooms[player.room].GetComponent <Room>().player = true; //show player room
    }
예제 #6
0
        void Start()
        {
            bool debug = false;
            int  size;
            int  itemsCount;

            if (debug)
            {
                do
                {
                    Clear();
                    WriteLine("Enter size");
                }while (!int.TryParse(ReadLine(), out size));
                do
                {
                    Clear();
                    WriteLine("Enter count of items to generate");
                }while (!int.TryParse(ReadLine(), out itemsCount));
            }
            else
            {
                size       = 5;
                itemsCount = 4;
            }

            while (true)
            {
                var gameMap = new GameMap(size, itemsCount, 2, new[] { 2, 4 });
                gameMap.Start();
                Clear();
                bool cantMove = false;

                while (true)
                {
                    Render(gameMap);
                    SetCursorPosition(0, 4 + size);
                    WriteLine("Your next move?");
                    if (cantMove)
                    {
                        WriteLine("Can't make move!");
                    }
                    else
                    {
                        WriteLine("                ");
                    }
                    Write("                        ");
                    SetCursorPosition(0, CursorTop);
                    var key1 = ReadKey();
                    if (key1.Key == ConsoleKey.Escape)
                    {
                        return;
                    }
                    if (key1.Key == ConsoleKey.Backspace)
                    {
                        break;
                    }
                    var key2 = ReadKey();
                    if (TryGetIndex(new string(new[] { key1.KeyChar, key2.KeyChar }), out int x, out int y))
                    {
                        if (!gameMap.MakeMove(x, y))
                        {
                            cantMove = true;
                        }
                        else
                        {
                            cantMove = false;
                        }
                    }