예제 #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);
 }
 /// Normalize
 private void Normalize() {
     normalized = new SymbolBase();
     normalized.Add(score);
     normalized.Normalize();
 }
 /// Aggregate score
 private void Aggregate()
 {
     score = new SymbolBase();
     foreach (var sym in phrase.symbols)
     { score.Add(sym); }
 }
 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;
 }