Example #1
0
    void Start()
    {
        weights [0] = 1;
        for (int i = 1; i < maxMonsterLevelPossible; i++)
        {
            weights [i] = weights [i - 1] * multiplier;
        }

        // Putting the position of units
        selectedUnit.GetComponent <Unit>().carrying = false;
        selectedUnit.GetComponent <Unit>().tileX    = 4;
        selectedUnit.GetComponent <Unit>().tileY    = 4;
        initialX = Random.Range(0, 6);
        //initialY = Random.Range (0, 6);
        StartCoroutine("unitWalkIn");
        //selectedMonster.GetComponent<Monsters>().tileX = ;
        //selectedMonster.GetComponent<Monsters>().tileY = Random.Range(0,6);

        for (int i = 0; i < mapSizeX; i++)
        {
            for (int j = 0; j < mapSizeY; j++)
            {
                occupationArray [i, j] = false;
            }
        }
        selectedMonster.transform.position = TileCoordToWorldCoord(selectedMonster.GetComponent <Monsters>().tileX, selectedMonster.GetComponent <Monsters>().tileY);

        GenerateMapData();
        GenerateMapVisual();

        if (!music.MusicOn)
        {
            music.ToggleMusic();
        }
    }
Example #2
0
    SumMusic controller; // Link to controller

    /// <summary>Public accessor to toggle music from buttons</summary>
    public void ToggleMusic()
    {
        // Link object if we don't have it already
        if (controller == null)
        {
            // Find game object containing controller
            GameObject go = GameObject.Find("sumMusicController");
            // Log error and exit if the controller is missing
            if (go == null)
            {
                Debug.LogError("Required game object 'sumMusicController' is missing");
                return;
            }
            // Link component
            controller = go.GetComponent <SumMusic>();
        }
        controller.ToggleMusic(); // Call the ToggleMusic method on the controller
    }