internal void loadBehaviors(Entity entity, EntityProperties properties, IWorldAccessor world) { if (BehaviorsAsJsonObj == null) { return; } this.Behaviors.Clear(); for (int i = 0; i < BehaviorsAsJsonObj.Length; i++) { string code = BehaviorsAsJsonObj[i]["code"].AsString(); if (code == null) { continue; } if (world.ClassRegistry.GetEntityBehaviorClass(code) != null) { EntityBehavior behavior = world.ClassRegistry.CreateEntityBehavior(entity, code); Behaviors.Add(behavior); behavior.Initialize(properties, BehaviorsAsJsonObj[i]); } else { world.Logger.Notification("Entity behavior {0} for entity {1} not found, will not load it.", code, properties.Code); } } }
internal void loadBehaviors(Entity entity, EntityProperties properties, IWorldAccessor world) { if (BehaviorsAsJsonObj == null) { return; } this.Behaviors.Clear(); for (int i = 0; i < BehaviorsAsJsonObj.Length; i++) { string code = BehaviorsAsJsonObj[i]["code"].AsString(); if (code == null) { continue; } EntityBehavior behavior = world.ClassRegistry.CreateEntityBehavior(entity, code); Behaviors.Add(behavior); behavior.Initialize(properties, BehaviorsAsJsonObj[i]); } }