Skip to content

Instantly share code, notes, and snippets.

@grofit
Last active May 17, 2020 18:45
Show Gist options
  • Save grofit/e89170d647e432041da6 to your computer and use it in GitHub Desktop.
Save grofit/e89170d647e432041da6 to your computer and use it in GitHub Desktop.
Example of view separation with composition
public class NoCompositionOrSeparationItem
{
public Sprite ItemImage;
public Vector3 InventoryPosition;
public Image ItemOverlay;
public string Name {get;set;}
public ItemType Type {get;set;}
public int Value {get;set;}
}
public class SeparatedItem
{
public string Name {get;set;}
public ItemType Type {get;set;}
public int Value {get;set;}
}
public class CompositionWithItem
{
public Sprite ItemImage;
public Vector3 InventoryPosition;
public Image ItemOverlay;
public SeparatedItem Item {get;set;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment