Class ComponentType

java.lang.Object
com.csse3200.game.components.ComponentType

public class ComponentType extends Object
Internal type system for components. Used to generate unique IDs for each component type at runtime, allowing entities to get components by type.
  • Method Details

    • getFrom

      public static ComponentType getFrom(Class<? extends Component> type)
      Gets or creates a ComponentType for the specified component class.
      Parameters:
      type - the component class
      Returns:
      the ComponentType for the class
    • getId

      public int getId()
      Gets the unique ID of this component type.
      Returns:
      the component type ID