game_actor_component_actor_component.js

/**
 * @module ActorComponent
 * @fileoverview Contains ActorComponent class.
 */

/**
 * @class
 * @abstract
 * Base component for adding additional functionality to actors.
 */
class ActorComponent {
    /**
     * Create a new actor component.
     * @constructor
     */
    constructor() {
        this.actor = null;
    }

    /**
     * Initialize the component.
     */
    init() {}

    /**
     * Handle the deletion of the component.
     */
    destructor() {}

    /**
     * Update the component.
     * @param {number} elapsed Time since last update cycle in seconds
     */
    update(elapsed) {}

    /**
     * Draw the component.
     * @param {CanvasRenderingContext2D} ctx Canvas context to draw on
     */
    draw(ctx) {}

    /**
     * Draw debugging info for the component.
     * @param {CanvasRenderingContext2D} ctx Canvas context to draw on
     */
    drawDebug(ctx) {}
}

export default ActorComponent;