public void calcProbabilities() { // Shhh.. I shouldn't call this here crewText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/crewText").ToString()); // Calc level probabilities this.levelProps = new float[this.skillLevelsPropabilities.Length]; int levelSum = 0; for (int i = 0; i < this.skillLevelsPropabilities.Length; ++i) { this.levelProps[i] = this.skillLevelsPropabilities[i]; levelSum += this.skillLevelsPropabilities[i]; } for (int i = 0; i < this.levelProps.Length; ++i) { this.levelProps[i] /= levelSum; } // Calc type probabilities this.skillTypeProps = new float[this.skillLevelsPropabilities.Length]; int skillSum = 0; for (int i = 0; i < this.skillTypesPropabilities.Length; ++i) { this.skillTypeProps[i] = this.skillTypesPropabilities[i]; skillSum += this.skillTypesPropabilities[i]; } for (int i = 0; i < this.skillTypeProps.Length; ++i) { this.skillTypeProps[i] /= skillSum; } }
public void Start() { junkText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/junkText").ToString()); alcoholText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/alcoholText").ToString()); fuelText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/fuelText").ToString()); airText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/airText").ToString()); flairShipText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/flairShipText").ToString()); flairClothText = RarityText.CreateFromJSON(Resources.Load <TextAsset>("itemText/flairClothText").ToString()); }