Factory Changes
Factory now has the ability to persist its state Added exponents to control speed/quality tradeoff and quality randomness
This commit is contained in:
parent
967b146d87
commit
8986575c59
14 changed files with 173 additions and 273 deletions
|
|
@ -33,7 +33,7 @@ public class Entity : DatabaseEntry, IMessagePackSerializationCallbackReceiver
|
|||
[IgnoreMember] public float SpecificHeat { get; private set; }
|
||||
[IgnoreMember] public float Visibility => VisibilitySources.Values.Sum();
|
||||
|
||||
public object[] PersistedBehaviors;
|
||||
public PersistentBehaviorData[] PersistedBehaviors;
|
||||
|
||||
public Entity(GameContext context, Gear hull, IEnumerable<Gear> items, IEnumerable<ItemInstance> cargo)
|
||||
{
|
||||
|
|
@ -129,6 +129,14 @@ public class Entity : DatabaseEntry, IMessagePackSerializationCallbackReceiver
|
|||
.SelectMany(i => i.ItemData.Behaviors
|
||||
.Select(bd => bd.CreateInstance(Context, this, i)))
|
||||
.OrderBy(b => b.GetType().GetCustomAttribute<UpdateOrderAttribute>()?.Order ?? 0).ToList();
|
||||
|
||||
var index = 0;
|
||||
foreach (var persistentBehavior in Behaviors
|
||||
.Where(b => b is IPersistentBehavior)
|
||||
.Cast<IPersistentBehavior>())
|
||||
{
|
||||
persistentBehavior.Restore(PersistedBehaviors[index++]);
|
||||
}
|
||||
|
||||
Bindings = Behaviors
|
||||
.Where(b => b is IActivatedBehavior)
|
||||
|
|
|
|||
Loading…
Reference in a new issue