25 lines
561 B
GDScript
25 lines
561 B
GDScript
|
|
extends Node
|
||
|
|
|
||
|
|
class_name OwniverseEvolution
|
||
|
|
|
||
|
|
var batch_count: int = 40
|
||
|
|
var entity_batches = {}
|
||
|
|
|
||
|
|
var distribution: Dictionary[String, float] = {}
|
||
|
|
|
||
|
|
|
||
|
|
func update_distribution(_distribute_by: Dictionary[String, float]) -> void:
|
||
|
|
distribution = {}
|
||
|
|
var _total: float = 0
|
||
|
|
for id in _distribute_by:
|
||
|
|
if _distribute_by[id] != 0:
|
||
|
|
var _value: float = _distribute_by[id]
|
||
|
|
_total += _value
|
||
|
|
distribution[id] = _value
|
||
|
|
|
||
|
|
if _total == 0: return
|
||
|
|
|
||
|
|
for id in distribution:
|
||
|
|
distribution[id] /= _total
|
||
|
|
|