コード例 #1
0
 /// Delta between this symbol and some other one
 /// 0f = no difference
 /// 1f = all totally different
 public float Delta(SymbolBase other)
 {
     var hd = other.humidity - this.humidity;
     var td = Math.Abs(other.temperature - this.temperature) / 2f;
     var wd = other.wind - this.wind;
     return Mathf.Sqrt(hd * hd + td * td + wd * wd);
 }
コード例 #2
0
 /// Normalize
 private void Normalize() {
     normalized = new SymbolBase();
     normalized.Add(score);
     normalized.Normalize();
 }
コード例 #3
0
 /// Aggregate score
 private void Aggregate()
 {
     score = new SymbolBase();
     foreach (var sym in phrase.symbols)
     { score.Add(sym); }
 }
コード例 #4
0
 public void PickRandomWeatherTarget()
 {
     genNewTarget = false;
     var targets = WeatherUtils.KnownWeather();
     KnownWeatherPattern new_target = null;
     for (var i = 0; i < 10; ++i)
     {
         new_target = Jam.Utils.Random.Pick(targets);
         if (new_target.weather != targetWeatherId)
         {
             break;
         }
     }
     if (new_target != null)
     {
         targetWeatherId = new_target.weather;
         targetWeather = new_target.detail;
         SpawnPrefabForTarget();
     }
 }
コード例 #5
0
 /// Add another symbol to this one
 public void Add(SymbolBase symbol)
 {
     humidity += symbol.humidity;
     temperature += symbol.temperature;
     wind += symbol.wind;
 }