void Start()
 {
     // script ref
     generator = GetComponent <MazeConstructor>();
     // cal func
     StartNewGame();
 }
Пример #2
0
    /*
     * Initialization method
     */
    private void Start()
    {
        ScenesController scenesController =
            GameObject.FindGameObjectWithTag("ScenesController").GetComponent <ScenesController>();

        mazeConstructor = GetComponent <MazeConstructor>();
        respawnSystem   = GetComponent <RespawnSystem>();
        mazeSurface     = GetComponent <NavMeshSurface>();

        // Maze construction
        mazeConstructor.GenerateNewMaze(scenesController.currentMazeRows, scenesController.currentMazeColumns);

        // Spawn system initialization
        respawnSystem.InitilizeRespawnSystem(mazeConstructor.mazeData);

        // Maze nav mesh surface baking
        mazeSurface.BuildNavMesh();

        // Player positioning
        respawnSystem.SetPlayerRespawn();

        // Enemy respawns
        respawnSystem.SetEnemyRespawnsPositions();

        // Final point
        respawnSystem.SetFinalPoint();

        // Consumables
        respawnSystem.SetConsumableLocations();
    }
Пример #3
0
    /// <summary>
    /// function called when the player hits the start button on the main menu
    /// </summary>
    public void StartGame()
    {
        //shows the correct UI
        uiManager.ActivateInGameUI();

        //generates the maze with the right sizes
        generator = GetComponent <MazeConstructor>();
        width     = initialWidth;
        height    = initialHeight;
        generator.GenerateNewMaze(initialWidth, initialHeight);

        //set the camera to the center of the maze as the maze grow through the levels
        cam.GetComponent <Camera>().orthographicSize = initialCameraZoom;
        CameraPosition();

        //we start at level 1
        level = 1;
        uiManager.UpdateLevelIndicator(level);
        if (playerInstanciated == false)
        {
            //we instanciate the player and set it to the right position
            player             = Instantiate(player, Vector3.zero, Quaternion.identity);
            playerInstanciated = true;
        }
        else
        {
            //if we already instatiated the player, just set it active
            //can happen if we restart playing. We don't need to instatiate an other player
            player.SetActive(true);
        }
        //sets the player at the right location
        player.GetComponent <PlayerController>().CharacterInitialPosition();
    }
Пример #4
0
    public void beginSession()
    {
        deleteButton.enabled = false;

        duringCanvas.GetComponent <Canvas> ().enabled = true;
        startCanvas.GetComponent <Canvas> ().enabled  = false;



        mazeInstance = Instantiate(mazePrefab) as MazeConstructor;

        mazeInstance.mazeSize    = mazeSizeSetting;
        mazeInstance.hallwaySize = mazeCorridorSetting;
        mazeInstance.buildDelay  = (float)mazeSpeedSetting;
        mazeInstance.botSpeed    = botSpeedSetting;


        if (sessionCheck)
        {
            establishSession();
        }
        else
        {
            establishNewInstance();
        }
        StartCoroutine(mazeInstance.Generate());

        deleteButton.enabled = true;
    }
Пример #5
0
        public MazeViewModel(MazeSettings settings)
        {
            _Settings            = settings;
            _Constructor         = new MazeConstructor(settings);
            _CellsViewModelsList = GetCellsViewModelsList();

            Content = GetMazeVisualization();
        }
 void Start()
 {
     _agentGO       = GameObject.Instantiate(_agentGO, this.transform);
     _destinationG0 = GameObject.Instantiate(_destinationG0, this.transform);
     _generator     = GetComponent <MazeConstructor>();
     _navAgent      = _agentGO.GetComponent <NavMeshAgent>();
     StartNewMaze();
     _isFirstTime = false;
 }
Пример #7
0
 void Start()
 {
     generator  = GetComponent <MazeConstructor>();
     objectBank = FindObjectOfType <ObjectBank>();
     trees      = new GameObject("Trees");
     arbors     = new GameObject("Arbors");
     banks      = new GameObject("Banks");
     StartNewGame();
 }
Пример #8
0
    void Start()
    {
        //if (!PV.IsMine)
        //{
        //    return;
        //}
        generator = GetComponent <MazeConstructor>();

        // PV.RPC("StartNewGame", RpcTarget.All);
        StartNewGame();
    }
Пример #9
0
    //3
    void Start()
    {
        generator = GetComponent <MazeConstructor>();

        if (SaveData.difficulty == 0)
        {
            StartNewGame(2);
        }
        else
        {
            StartNewGame(SaveData.difficulty);
        }
    }
    void Start()
    {
        generator = GetComponent <MazeConstructor>();
        // A private variable that stores a reference returned by the GetComponent()

        generator.GenerateNewMaze(height, width);
        //parameters dictate how large to make the maze. While they aren't being used quite yet,
        //these size parameters determine the number of rows and columns in the grid respectively.
        Text = GameObject.Find("Text").GetComponent <Text>();

        Text.text   = "Level: " + level;
        PauseMenu   = GameObject.Find("Panel");
        StartButton = GameObject.Find("StartButton");
    }
Пример #11
0
    void Start()
    {
        generator = GetComponent <MazeConstructor>();      // 2
        generator.GenerateNewMaze(sizex, sizey);
        int[] myHousePosition = new int[] { sizex - 2, sizey - 1 };

        for (int y = 0; y < sizey; y++)
        {
            for (int x = 0; x < sizex; x++)
            {
                if (x == sizex - 2 && y == sizey - 1)
                {
                    Instantiate(MyHouse, new Vector3(x * spriteSize * sizeMultiplier, y * spriteSize * sizeMultiplier, 0), Quaternion.identity);
                }
                else
                {
                    if (generator.data[x, y] == 1)
                    {
                        if (randomBoolean())
                        {
                            Instantiate(Wall, new Vector3(x * spriteSize * sizeMultiplier, y * spriteSize * sizeMultiplier, 0), Quaternion.identity);
                        }
                        else
                        {
                            Instantiate(Wall2, new Vector3(x * spriteSize * sizeMultiplier, y * spriteSize * sizeMultiplier, 0), Quaternion.identity);
                        }
                    }
                    else
                    {
                        Instantiate(Road, new Vector3(x * spriteSize * sizeMultiplier, y * spriteSize * sizeMultiplier, 1), Quaternion.identity);
                    }
                }
            }
        }
        Instantiate(Player, new Vector3(1 * spriteSize, 1 * spriteSize, 0), Quaternion.identity);
        // Instantiate(Player, new Vector3(myHousePosition[0] * spriteSize, (myHousePosition[1]-1) * spriteSize, 0), Quaternion.identity);
        Tuple <int, int> enemyPosition = RandomPosition();

        Debug.Log("enemyPosition=" + enemyPosition.Item1 + "," + enemyPosition.Item2);
        Instantiate(Enemy, new Vector3(enemyPosition.Item1 * spriteSize * sizeMultiplier, enemyPosition.Item2 * spriteSize * sizeMultiplier, 0), Quaternion.identity);

        Tuple <int, int> keyPosition = RandomPosition();

        Debug.Log("keyPosition=" + keyPosition.Item1 + "," + keyPosition.Item2);
        Instantiate(Key, new Vector3(keyPosition.Item1 * spriteSize * sizeMultiplier, keyPosition.Item2 * spriteSize * sizeMultiplier, 0), Quaternion.identity);
        // Instantiate(Key, new Vector3(3 * spriteSize, 1 * spriteSize, 0), Quaternion.identity);
        GameObject.FindWithTag("MainCamera").GetComponent <CameraController>().gameAreaY = sizey * spriteSize * sizeMultiplier;
        GameObject.FindWithTag("MainCamera").GetComponent <CameraController>().gameAreaX = sizex * spriteSize * sizeMultiplier;
    }
Пример #12
0
 // Start is called before the first frame update
 void Start()
 {
     generator = GetComponent <MazeConstructor>();
     mapSize   = PlayerPrefs.GetString("Map");
     if (mapSize.Equals("Medium"))
     {
         maxCols = 13;
         maxRows = 15;
     }
     else
     {
         maxCols = 17;
         maxRows = 19;
     }
     GlobalVars.maxCols = maxCols;
     GlobalVars.maxRows = maxRows;
     StartGame();
 }
Пример #13
0
 void Start()
 {
     generator = GetComponent <MazeConstructor>();
     sizeRows  = 13;
     sizeColms = 15;
 }
Пример #14
0
    public static int sizeCols = 15;    //This value is the width of the maze.

    // Start is called before the first frame update
    void Start()
    {
        generator = GetComponent <MazeConstructor>();    //Gets the script component that generates the maze
        stickyCam = GetComponent <StickyCamera>();
        BeginMaze();
    }
Пример #15
0
 private void Start()
 {
     mC = GetComponent <MazeConstructor>();
     mC.GenerateNewMaze(13, 15);
 }
Пример #16
0
    //replace the character at the right position
    public void CharacterInitialPosition()
    {
        MazeConstructor mazeConstructor = GameController.gameController.GetComponent <MazeConstructor>();

        transform.position = new Vector3(mazeConstructor.xEntrance + 0.5f, mazeConstructor.yEntrance + 0.5f);
    }
Пример #17
0
 /**
  * \brief Start is called before the first frame update
  *
  * MazeConstructor object is created and the default
  * row and column values for the first maze are passed
  * to newMaze(float, float) function
  *
  * \return null
  */
 void Start()
 {
     generator = GetComponent <MazeConstructor>();
     newMaze(27, 23);
 }
Пример #18
0
 void Start()
 {
     // A private variable that stores a reference returned by the GetComponent().
     generator = GetComponent <MazeConstructor>();
     generator.GenerateNewMaze(13, 15);
 }
Пример #19
0
 void Start()                                      //На СтАрТ!
 {
     generator = GetComponent <MazeConstructor>(); //Частная переменная хранит ссылку, возвращаемую GetComponent()
     StartNewGame();
 }
Пример #20
0
 void Start()
 {
     generator = GetComponent <MazeConstructor>();      // 2
     generator.GenerateNewMaze(31, 33);
 }
Пример #21
0
 void Start()
 {
     // Хранение данных о компоненте MazeConstructor в generator
     generator = gameObject.GetComponent <MazeConstructor>();
     StartNewGame();
 }
Пример #22
0
 private void Start()
 {
     generator = GetComponent <MazeConstructor>();
     generator.GenerateNewMaze(13, 15);
     //EventMa
 }
Пример #23
0
 //3
 void Start()
 {
     generator = GetComponent <MazeConstructor>();
     StartNewGame();
 }
Пример #24
0
 void Start()
 {
     generator = GetComponent <MazeConstructor>();
     StartNewGame();
     winningButton.onClick.AddListener(Application.Quit);
 }