import { Coroutine } from "../coroutine/Coroutine"; import type { CoroutineIterator } from "../coroutine/CoroutineIterator"; import type { EngineGlobalObject } from "../EngineGlobalObject"; import type { ComponentConstructor } from "./ComponentConstructor"; import type { GameObject } from "./GameObject"; import type { Transform } from "./Transform"; /** * component is the base class from which every engine script derives * * do not override constructor it's break the engine */ export declare abstract class Component { /** * if this true, this component can't be added multiple times to the same game object */ readonly disallowMultipleComponent: boolean; /** * if this array is not empty, this component can be added only if all of the components in this array are already added to the game object */ readonly requiredComponents: ComponentConstructor[]; /** * script execution order of this component */ readonly executionOrder: number; private _enabled; private readonly _gameObject; private readonly _instanceId; private readonly _runningCoroutines; constructor(gameObject: GameObject); /** * starts a coroutine * * if component is destroyed this will throw an error * @param coroutineIterator coroutine iterator * @returns coroutine instance. you can stop coroutine by calling stopCoroutine(coroutine: ICoroutine) with this variable */ startCoroutine(coroutineIterator: CoroutineIterator): Coroutine; /** * stop all coroutines executed by this component * * if component is destroyed this will throw an error */ stopAllCoroutines(): void; /** * stop coroutine that is executed by this component * * if component is destroyed this will throw an error * @param coroutine coroutine instance */ stopCoroutine(coroutine: Coroutine): void; /** * enabled components are updated, disabled components are not */ get enabled(): boolean; /** * enabled components are updated, disabled components are not * * if component is destroyed this will throw an error */ set enabled(value: boolean); private checkComponentIsExist; /** * game object this component belongs to */ get gameObject(): GameObject; /** * transform attached to this component game object */ get transform(): Transform; /** * global engine object */ get engine(): EngineGlobalObject; /** * get instance id of this component */ get instanceId(): number; /** * if instantiate process is finished, this will be true */ get initialized(): boolean; /** * does the component exist? */ get exists(): boolean; /** * destroy this component */ destroy(): void; }