//initialization
    void Start()
    {
        //set reference to GUI Texts
        promptGUI = GameObject.Find("Canvas/PrompterText").GetComponent<Text>();
        inputGUI = GameObject.Find("Canvas/InputText").GetComponent<Text>();
        playerGUI = GameObject.Find("Canvas/PlayerText").GetComponent<Text>();
        arrowGUI = GameObject.Find("Canvas/ArrowText").GetComponent<Text>();
        gameGUI = GameObject.Find("Canvas/GameText").GetComponent<Text>();

        //set reference to controller variables
        inputControl = GameObject.Find("GameController").GetComponent<InputController>();
        gameController = GameObject.Find("GameController").GetComponent<GameController>();
        imgController = GameObject.Find("GameController").GetComponent<ImagePlaneController>();

        //init text variables
        prompterText = "";
        inputText = "";
        playerText = "";
        gameText = "";
        arrowText = "";

        //init textDictionary
        textDictionary = new Dictionary<InputMode, string>();
        textDictionary.Add(InputMode.getMove, "(M)ove or (S)hoot?");
        textDictionary.Add(InputMode.getRoom, "Pick a room to move into");
        textDictionary.Add(InputMode.getArrowPath, "Pick a room to shoot your arrow through : ");
        textDictionary.Add(InputMode.won, "Aha! You got the Wumpus! ");
        textDictionary.Add(InputMode.lost, "You lost! ");
        textDictionary.Add(InputMode.wumpus, "Oops, bumped a Wumpus!");
        textDictionary.Add(InputMode.bat, "Zap--Super Bat snatch! Elsewhereville for you!");
        textDictionary.Add(InputMode.pit, "YYYIIIIEEEE . . . fell in a pit");
        textDictionary.Add(InputMode.getPlayAgain, "Play again? \n 1)New game, hazards in SAME place \n 2) New game, hazards in NEW places \n 3) Quit");
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        rend = GetComponent<Renderer>();
        trans = GetComponent<Transform>();
        imgController = GameObject.Find("GameController").GetComponent<ImagePlaneController>();

        id = Int32.Parse(gameObject.name.Substring(12));
        inputController = GameObject.Find("GameController").GetComponent<InputController>();
    }
    void Start()
    {
        hazard_cap = 2;
        wumpusCave = new Cave();
        player = new Player("Hunter");
        wumpus = new Wumpus("Wumpy");
        bats = new List<Bat>(hazard_cap);
        pits = new List<Pit>(hazard_cap);

           //init bats & pits
           for (int i = 0; i < hazard_cap; i++ ){
           Bat bat = new Bat(i.ToString());
           bats.Add(bat);
           Pit pit = new Pit(i);
           pits.Add(pit);
            }

           positions = new int[6];
           setup(1);

           //assign player references to controllers
           //*I don't like it but I run into Object reference not set to an instance errors otherwise..
           inputController = GetComponent<InputController>();
           guiController =  GameObject.Find("Canvas").GetComponent<GUIController>();
           imgController = GetComponent<ImagePlaneController>();
           inputController.player = player;
           guiController.player = player;
           guiController.gameState = STATE;

           //assign Room prefabs to a room DAO
           Transform Rooms = GameObject.Find("WumpusCave/Rooms").GetComponent<Transform>();
           UnityEngine.Debug.Log(Rooms.childCount);
           for(int i = 0; i < Rooms.childCount; i++)
           Rooms.GetChild(i).GetComponent<RoomBehavior>().room = wumpusCave.rooms[i];
    }