Unit in SuperTiles consists of three main components: UnitData, UnitEntity and UnitView

UnitData is an information storage with default values like Health or MoveRange. 

UnitData contains:

  • Visual data (Avatar, prefab Model, custom Collider prefab, UI Holder position)
  • Tags which would be used for gameplay logic (for example Capture item affects only units with the Building tag)
  • Stats information (Health max value, current Move Range value, etc.) 
  • List of Default items which would be added to unit at the Game start
  • Health Action - should be default health bar be replaced with custom one?
  • Died Action 
    • Rebirth - should be the unit resurrected after the death?
    • Killer Take Control - should the unit change his squad controller to the same as the killer has?
  • Unit Change Controller Action
    • Should be the color of unit's model changed when the unit's squad controller is changed?

Unit Editor window was designed to simplify Unit duplication and editing

UnitEntity is a wrapper of UnitData which contains actual unit state

  • Current unit id
  • Values of unit stats
  • Is this unit incorporeal or not?
  • Is it alive or not?
  • Effects which are on the unit, etc.

UnitView is a visual representation of UnitEntity. It inherits MonoBehaviour class and attached to the root gameobject of Unit prefab.

UnitView view contains information about 

  • The reference to the model gameobject that was instantiated for the Unit 
  • Unit world space position and rotation

Created with the Personal Edition of HelpNDoc: Effortlessly Create Encrypted, Password-Protected PDFs