Beispiel #1
0
    public static Tuple <bool, float> GetStockChangePercent(VolatilityDetail detail)
    {
        bool isCrashing = UnityEngine.Random.Range(1f, 100f) < detail.chanceOfCrash;

        if (isCrashing)
        {
            return(Tuple.Create(true, -1 * UnityEngine.Random.Range(detail.minCrashPercent, detail.maxCrashPercent)));
        }

        float directionModifier = UnityEngine.Random.Range(1f, 100f) < detail.chanceOfIncrease ? 1 : -1;

        return(Tuple.Create(false, directionModifier * UnityEngine.Random.Range(detail.minIncrease, detail.maxIncrease)));
    }
Beispiel #2
0
 public StockData(StockType stockType)
 {
     this.StockType = stockType;
     volatility     = GameUtils.GetVolatility(stockType.Riskyness);
     sharePrice     = Random.Range(stockType.MinStartingValue, stockType.MaxStartingValue);
 }