コード例 #1
0
    private void initializeGrid()
    {
        filledCellColor = colorScheme.randomCellColor;
        planeBorders.material.DOColor(colorScheme.randomBorderColor, .1f);

        Color randomEmptyCellColor = colorScheme.randomBottomCellColor;

        Array.ForEach(FindObjectsOfType <EmptyCell>(), cell => cell.setColor(randomEmptyCellColor));

        grid.spawnGridCells(defaultCellPrefab);

        // randomize bombs count
        if (gameController.gameSettings.currentSavedLevel < 3)
        {
            bombsCount = UnityEngine.Random.Range(0, 2);
        }
        else if (gameController.gameSettings.currentSavedLevel >= 3 && gameController.gameSettings.currentSavedLevel < 10)
        {
            bombsCount = UnityEngine.Random.Range(2, 4);
        }
        else if (gameController.gameSettings.currentSavedLevel >= 10 && gameController.gameSettings.currentSavedLevel < 16)
        {
            bombsCount = UnityEngine.Random.Range(4, 6);
        }
        else if (gameController.gameSettings.currentSavedLevel >= 16)
        {
            bombsCount = UnityEngine.Random.Range(5, 8);
        }

        for (int i = 0; i < bombsCount.value; i++)
        {
            swapCell(grid.randomDefaultCell(), bombCellPrefab);
        }
    }
コード例 #2
0
    void Awake()
    {
        audioSource.ignoreListenerVolume = ignoreListenerVolume;
        audioSource.ignoreListenerPause  = ignoreListenerPause;

        if (pitch == -1f)
        {
            pitch = audioSource.pitch;
        }
        if (volume == -1f)
        {
            volume = audioSource.volume;
        }
    }
コード例 #3
0
    private void Awake()
    {
        placer = GetComponent <Placer>();
        placer.objectPlaced += onObjectPlacedOnPath;

        pathCreator = placer.pathCreator;
        ignoredAxis = placer.ignoredAxis;

        if (endInstruction == EndOfPathInstruction.Loop && pathCreator != null && !pathCreator.path.isClosedLoop)
        {
            endInstruction = EndOfPathInstruction.Reverse;
            backwardSpeed  = forwardSpeed;
        }
    }