コード例 #1
0
    private void Start()
    {
        Vector2Int t_currentTile = m_grille.WorldToGrid(new Vector3(transform.position.x, transform.position.y, transform.position.z));

        m_playerLastTuile = t_currentTile;
        PlayerLastTuile   = m_grille.GetTuile(t_currentTile);
        m_GH = FindObjectOfType <GameHandler>();
        EndPanel.SetActive(false);
        Invoke("MyUpdate", 0f);
    }
コード例 #2
0
        //SetupScene initializes our level and calls the previous functions to lay out the game board
        public void SetupScene(int a_level)
        {
            Camera m_Camera = FindObjectOfType <Camera>();

            //Creates the outer walls and floor.
            BoardSetup();

            //Reset our list of gridpositions.
            InitialiseList();

            //Instantiate a random number of wall tiles based on minimum and maximum, at randomized positions.
            LayoutObjectAtRandom(wallTiles, wallCount.minimum, wallCount.maximum);

            //Instantiate a random number of food tiles based on minimum and maximum, at randomized positions.
            LayoutObjectAtRandom(weaponTiles, weaponCount.minimum, weaponCount.maximum);

            //Determine number of enemies based on current level number, based on a logarithmic progression
            //int t_spawnerCount = (int)Mathf.Log(a_level, 6f);

            //Instantiate a random number of enemies based on minimum and maximum, at randomized positions.
            LayoutObjectAtRandom(spawnerTiles, spawnerCount.minimum, spawnerCount.maximum);

            //Instantiate the exit tile in the upper right hand corner of our game board
            t_perso = Instantiate(exit, new Vector3(m_MinColumns + 1, m_MinRows + 1, 0f), Quaternion.identity);
            t_perso.GetComponent <PersoController>().Cam        = m_Camera;
            m_Camera.GetComponent <FollowTargetRandom>().Target = t_perso.transform;
            PersoController t_PersoController = t_perso.GetComponent <PersoController>();

            t_PersoController.ScoreText = FindObjectOfType <Canvas>().transform.GetChild(1).GetComponent <TextMeshProUGUI>();
            t_PersoController.VieText   = FindObjectOfType <Canvas>().transform.GetChild(2).GetComponent <TextMeshProUGUI>();
            grille.AppellerTuiles(boardHolder.transform);
            t_PersoController.PlayerLastTuile = grille.GetTuile(grille.WorldToGrid(t_perso.transform.position));
            t_PersoController.EndPanel        = FindObjectOfType <Canvas>().transform.GetChild(5).gameObject;
            t_perso.GetComponent <PersoInteract>().Interact = FindObjectOfType <Canvas>().transform.GetChild(3).transform.GetChild(0).gameObject;
            t_perso.GetComponent <Shooting>().MunitionsText = FindObjectOfType <Canvas>().transform.GetChild(4).GetComponent <TextMeshProUGUI>();
        }