Beispiel #1
0
    private void CreatePassage(MazeCell cell, MazeCell otherCell, MazeDirection direction)
    {
        MazePassage prefab;

        if (Random.value < eventProbability && eventCounter > 0)
        {
            //if(eventCounter > 0){
            eventCounter--;
            prefab = eventPrefab;
            MazePassage chal = Instantiate(prefab) as EventTrigger;
            chal.Initialize(cell, otherCell, direction);
            chal.GetComponent <EventTrigger>().SetChallengeManagerRef(challengeManagerInst);
            prefab = passagePrefab;
            chal   = Instantiate(prefab) as MazePassage;
            chal.Initialize(otherCell, cell, direction.GetOpposite());
        }
        else
        {
            prefab = passagePrefab;
            //MazePassage prefab = Random.value < doorProbability ? doorPrefab : passagePrefab;
            MazePassage passage = Instantiate(prefab) as MazePassage;
            passage.Initialize(cell, otherCell, direction);
            passage = Instantiate(prefab) as MazePassage;
            passage.Initialize(otherCell, cell, direction.GetOpposite());
        }
    }