<commit_before>/**
 * Exports the {@link module:core/GameObject~GameObject|GameObject} class.
 * @module core/GameObject
 */
define(
  [
    'core/Common',
    'core/Timer',
    'core/Message',
    'collection/Map',
    'collection/LinkedList',
    'component/Base',
    'manager/MessageManager',
    'manager/PhysicsManager',
    'manager/SceneManager',
    'lib/Three'
  ],
  function( Common, Timer, Message, Map, LinkedList, Base, MessageManager, PhysicsManager, SceneManager, _Three ) {

    /**
     * The main build block of the engine. Create the game classes by inheriting from the Game Object.
     * For quick creation of GOs, it is also possible to use composition.
     *
     * @example
     * // Composition
     * var myGO = new m.GameObject( myGOId, myGOUpdateFunction );
     *
     * // Inheritance
     * var MyGOClass = function( id ) {
     *  m.GameObject.call( this, id );
     * };
     * MyGOClass.prototype = Object.create( m.GameObject.prototype );
     * MyGOClass.prototype.update = function() { ... };
     *
     * @param {String} id Identifier. Not mandatory, but recommended
     * @param {function} update The object logic. Not necessary if using inheritance
     * @param {THREE.Vector3} position Initial position
     * @param {THREE.Vector3} rotation Initial rotation
     * @param {THREE.Vector3} scale Initial scale
     * @class GameObject
     */
    var GameObject = function( id, update, position, rotation, scale ) {

      /**
       * Unique identifier, created automatically.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {String}
       * @name uid
       */
      this.uid = Common.createUniqueId();

      /**
       * The Game Object id, used to recover the GO instance wherever necessary.
       * Recommended to be explicitly set.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {String}
       * @name id
       * @default uid
       */
      this.id = id || this.uid;

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name position
       * @default THREE.Vector3( 0, 0, 0 )
       */
      this.position = ( position ) ? position : new THREE.Vector3( 0, 0, 0 );

      /**
       * Represents rotation (X, Y, Z) in radians
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Euler}
       * @name rotation
       * @default THREE.Euler( 0, 0, Math.PI, 'XYZ' )
       */
      this.rotation = ( rotation ) ? rotation : new THREE.Euler( 0, 0, Math.PI, 'XYZ' );

      /**
       * A direction vector, reference used to rotate objects in 2D space
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name direction
       * @default THREE.Vector3( 0, 1, 0 )
       */
      this.direction = new THREE.Vector3( 0, 1, 0 );

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name scale
       * @default THREE.Vector3( 1, 1, 1 )
       */
      this.scale = ( scale ) ? scale : new THREE.Vector3( 1, 1, 1 );

      /**
       * Axis with Y flipped to calculate properly according to the engine orthographic camera.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name axis
       * @default THREE.Vector3( 0, -1, 0 );
       */
      this.axis = new THREE.Vector3( 0, -1, 0 );

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Map}
       * @name components
       */
      this.components = new Map();

      /**
       * An iterator for the components.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @name componentsIt
       */
      this.componentsIt = this.components.iterator();

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {LinkedList}
       * @name messages
       */
      this.messages = new LinkedList();

      /**
       * List of Game Objects that are children of this.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Array}
       * @name children
       */
      this.children = [];

      /**
       * Controls if this Game Object will be rendered on canvas.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {boolean}
       * @name isVisible
       */
      this.isVisible = true;

      /**
       * Controls if this Game Object will be updated on engine cycle.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {boolean}
       * @name isActive
       */
      this.isActive = true;

      /**
       * Last time this Game Object was updated
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Number}
       * @name lastUpdate
       */
      this.lastUpdate = 0;

      if( update === 'function' ) {
        this.update = update;
      }<commit_msg>Bug fixing GO recursive update<commit_after>/**
 * Exports the {@link module:core/GameObject~GameObject|GameObject} class.
 * @module core/GameObject
 */
define(
  [
    'core/Common',
    'core/Timer',
    'core/Message',
    'collection/Map',
    'collection/LinkedList',
    'component/Base',
    'manager/MessageManager',
    'manager/PhysicsManager',
    'manager/SceneManager',
    'lib/Three'
  ],
  function( Common, Timer, Message, Map, LinkedList, Base, MessageManager, PhysicsManager, SceneManager, _Three ) {

    /**
     * The main build block of the engine. Create the game classes by inheriting from the Game Object.
     * For quick creation of GOs, it is also possible to use composition.
     *
     * @example
     * // Composition
     * var myGO = new m.GameObject( myGOId, myGOUpdateFunction );
     *
     * // Inheritance
     * var MyGOClass = function( id ) {
     *  m.GameObject.call( this, id );
     * };
     * MyGOClass.prototype = Object.create( m.GameObject.prototype );
     * MyGOClass.prototype.update = function() { ... };
     *
     * @param {String} id Identifier. Not mandatory, but recommended
     * @param {function} update The object logic. Not necessary if using inheritance
     * @param {THREE.Vector3} position Initial position
     * @param {THREE.Vector3} rotation Initial rotation
     * @param {THREE.Vector3} scale Initial scale
     * @class GameObject
     */
    var GameObject = function( id, update, position, rotation, scale ) {

      /**
       * Unique identifier, created automatically.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {String}
       * @name uid
       */
      this.uid = Common.createUniqueId();

      /**
       * The Game Object id, used to recover the GO instance wherever necessary.
       * Recommended to be explicitly set.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {String}
       * @name id
       * @default uid
       */
      this.id = id || this.uid;

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name position
       * @default THREE.Vector3( 0, 0, 0 )
       */
      this.position = ( position ) ? position : new THREE.Vector3( 0, 0, 0 );

      /**
       * Represents rotation (X, Y, Z) in radians
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Euler}
       * @name rotation
       * @default THREE.Euler( 0, 0, Math.PI, 'XYZ' )
       */
      this.rotation = ( rotation ) ? rotation : new THREE.Euler( 0, 0, Math.PI, 'XYZ' );

      /**
       * A direction vector, reference used to rotate objects in 2D space
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name direction
       * @default THREE.Vector3( 0, 1, 0 )
       */
      this.direction = new THREE.Vector3( 0, 1, 0 );

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name scale
       * @default THREE.Vector3( 1, 1, 1 )
       */
      this.scale = ( scale ) ? scale : new THREE.Vector3( 1, 1, 1 );

      /**
       * Axis with Y flipped to calculate properly according to the engine orthographic camera.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {THREE.Vector3}
       * @name axis
       * @default THREE.Vector3( 0, -1, 0 );
       */
      this.axis = new THREE.Vector3( 0, -1, 0 );

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Map}
       * @name components
       */
      this.components = new Map();

      /**
       * An iterator for the components.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @name componentsIt
       */
      this.componentsIt = this.components.iterator();

      /**
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {LinkedList}
       * @name messages
       */
      this.messages = new LinkedList();

      /**
       * List of Game Objects that are children of this.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Array}
       * @name children
       */
      this.children = [];

      /**
       * Controls if this Game Object will be rendered on canvas.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {boolean}
       * @name isVisible
       */
      this.isVisible = true;

      /**
       * Controls if this Game Object will be updated on engine cycle.
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {boolean}
       * @name isActive
       */
      this.isActive = true;

      /**
       * Last time this Game Object was updated
       * @memberOf module:core/GameObject~GameObject
       * @instance
       * @type {Number}
       * @name lastUpdate
       */
      this.lastUpdate = 0;

      if( typeof( update ) === 'function' ) {
        this.update = update;
      }
{'fraction_non_alphanumeric': 0.1193942354665364, 'fraction_numerical': 0.008793356130923302, 'mean_word_length': 2.020359988197108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3598557', 'n_tokens_mistral': 3086, 'n_tokens_neox': 2960, 'n_words': 813}