Esempio n. 1
0
 public void calcDevelopmentScore()
 {
     if (confLevel == RandomFromDistribution.ConfidenceLevel_e._80 && ControlFactors.DEVELOPMENT_SCORE > 15000)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._60; Debug.Log("60");
     }
     else if (confLevel == RandomFromDistribution.ConfidenceLevel_e._90 && ControlFactors.DEVELOPMENT_SCORE > 10000)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._80; Debug.Log("80");
     }
     else if (confLevel == RandomFromDistribution.ConfidenceLevel_e._95 && ControlFactors.DEVELOPMENT_SCORE > 5000)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._90; Debug.Log("90");
     }
     else if (confLevel == RandomFromDistribution.ConfidenceLevel_e._98 && ControlFactors.DEVELOPMENT_SCORE > 2000)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._95; Debug.Log("95");
     }
     else if (confLevel == RandomFromDistribution.ConfidenceLevel_e._99 && ControlFactors.DEVELOPMENT_SCORE > 1000)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._98; Debug.Log("98");
     }
     else if (confLevel == RandomFromDistribution.ConfidenceLevel_e._999 && ControlFactors.DEVELOPMENT_SCORE > 500)
     {
         confLevel = RandomFromDistribution.ConfidenceLevel_e._99; Debug.Log("99");
     }
 }
Esempio n. 2
0
        void CreateCells()
        {
            RandomFromDistribution.ConfidenceLevel_e conf_level = RandomFromDistribution.ConfidenceLevel_e._80;

            int   numberOfCells    = levelStats.numberOfCells;
            float roomCircleRadius = levelStats.roomCircleRadius;

            percFromGraphToPaths = levelStats.percFromGraphToPaths;
            mainRoomMeanCutoff   = levelStats.mainRoomCutoff;

            float cellMinWidth  = levelStats.cellMinWidth;
            float cellMaxWidth  = levelStats.cellMaxWidth;
            float cellMinHeight = levelStats.cellMinHeight;
            float cellMaxHeight = levelStats.cellMaxHeight;

            for (int i = 0; i < numberOfCells; i++)
            {
                float minWidthScalar  = cellMinWidth;
                float maxWidthScalar  = cellMaxWidth;
                float minHeightScalar = cellMinHeight;
                float maxHeightScalar = cellMaxHeight;

                GeneratorCell cell = new GeneratorCell();
                cell.width  = Mathf.RoundToInt(RandomFromDistribution.RandomRangeNormalDistribution(minWidthScalar, maxWidthScalar, conf_level));
                cell.height = Mathf.RoundToInt(RandomFromDistribution.RandomRangeNormalDistribution(minHeightScalar, maxHeightScalar, conf_level));


                Vector2 pos = GetRandomPointInCirlce(roomCircleRadius);
                cell.posX  = Mathf.RoundToInt(pos.x);
                cell.posY  = Mathf.RoundToInt(pos.y);
                cell.index = i;
                cells.Add(cell);
                widthAvg  += cell.width;
                heightAvg += cell.height;
            }

            widthAvg  /= cells.Count;
            heightAvg /= cells.Count;
        }