refactor: remove Source property from IRelationship
Remove the redundant `Source` property from `IRelationship` and its implementations. Since the relationship component is inherently stored on the source entity, the `Source` field was unnecessary and required manual synchronization during deserialization. This change simplifies the relationship model, reduces memory usage, and removes the need for reflection-based fixups in the serializer.
This commit is contained in:
@@ -36,7 +36,7 @@ public class DeckSetupSystem : ISystem
|
||||
{
|
||||
var cardEntity = world.CreateEntity();
|
||||
world.AddComponent(cardEntity, new Card { Suit = suit, Rank = rank });
|
||||
world.AddComponent(cardEntity, new InDeck { Source = cardEntity, Target = deckEntity });
|
||||
world.AddComponent(cardEntity, new InDeck { Target = deckEntity });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DeckSetupSystem : ISystem
|
||||
}
|
||||
for (int i = 0; i < cardEntities.Length; i++)
|
||||
{
|
||||
world.AddComponent(cardEntities[i], new InDeck { Source = cardEntities[i], Target = deckEntity });
|
||||
world.AddComponent(cardEntities[i], new InDeck { Target = deckEntity });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user