コード例 #1
0
ファイル: Entity.java プロジェクト: dreamsxin/MalletEngine
  public final void removeComponent(final Component _component) {
    _component.setParent(null); // Required by j2Objc conversion, causes memory-leak otherwise
    components.remove(_component);

    final EventController controller = _component.getComponentEventController();
    eventSystem.removeEventHandler(controller);
  }
コード例 #2
0
ファイル: Entity.java プロジェクト: dreamsxin/MalletEngine
  /**
   * Add a component to the Entity and set its parent to the Entity The Component should not be
   * owned by another Component, it could get messy!
   */
  public final void addComponent(final Component _component) {
    _component.setParent(this);
    components.add(_component);

    final EventController controller = _component.getComponentEventController();
    controller.setAddEventInterface(eventSystem);
    eventSystem.addEventHandler(controller);
  }