Пример #1
0
    public static void setCustomLevel(int level = 1)     //setting up Custom level
    {
        if ((level - 1) >= levelManagerObj.playgroundList.Count)
        {
            if (onGameWonCallback != null)
            {
                onGameWonCallback();
            }
            return;
        }
        fruitsAte     = 0;
        isCustomLevel = true;
        circumscribedSquareHalfLength = levelManagerObj.playgroundList [level - 1].sideHalfLength;
        PlaygroundManagerClass.setCustomPlayground(levelManagerObj.playgroundList [level - 1]); //set ground
        SnakeManagerClass.instantiateSnakeHead();                                               //set player

        FruitManagerClass.setFruitParent();                                                     //set fruit
        checkForObstacleAndInstantiateFruitInRange(-circumscribedSquareHalfLength, circumscribedSquareHalfLength);
    }
Пример #2
0
    public static void setProceduralLevel(int level = 1)     //setting up Custom level
    {
        if (levelManagerObj.maxProceduralLevel <= 0 && level == levelManagerObj.maxProceduralLevel)
        {
            if (onGameWonCallback != null)
            {
                onGameWonCallback();
            }
            return;
        }
        fruitsAte = 0;
        int numOfSides = level + 2;

        inscribedCircleRadius         = levelManagerObj.inscribedRadiusOfProceduralPolygon;
        circumscribedSquareHalfLength = levelManagerObj.inscribedRadiusOfProceduralPolygon / Mathf.Cos(Mathf.PI / numOfSides);
        PlaygroundManagerClass.setProceduralPlayground(inscribedCircleRadius, numOfSides); //set ground
        SnakeManagerClass.instantiateSnakeHead();                                          //set player

        FruitManagerClass.setFruitParent();                                                //set fruit
        instantiateFruit(generateRandomPointInsidePlayground(-circumscribedSquareHalfLength, circumscribedSquareHalfLength));
        ObstacleManagerClass.setObstacleParent();
    }