Properties
node Node
Inherited from Component:
The node this component is attached to. A component is always attached to a node.
继承组件:节点附加到该组件,一个组件总是连着一个节点。
uuid String
Inherited from Component:
The uuid for editor
继承组件:编辑器UUID。
enabled Boolean
Inherited from Component:
indicates whether this component is enabled or not.
继承组件:指示是否使用该组件。
enabledInHierarchy Boolean
Inherited from Component:
indicates whether this component is enabled and its entity is also active in the hierarchy.
继承组件: 指示是否启用该组件及其实体在层次结构可用。
_isOnLoadCalled Boolean
name String
The name of the object.
对象名称。
isValid Boolean
Indicates whether the object is not yet destroyed。
指示对象是否还未销毁.
Method
update ( )
Update is called every frame, if the Component is enabled.
如果组件启用,将每帧调用Update().
lateUpdate ( )
LateUpdate is called every frame, if the Component is enabled.
如果组件启用,将每帧调用LateUpdate().( 在Update()后调用。)
onLoad ( )
When attaching to an active entity or its entity first activated
当附加到一个活跃的实体或其实体第一次激活.
start ( )
Called before all scripts' update if the Component is enabled
如果组件启用,在所有脚本Update之前调用。
onEnable ( )
Called when this component becomes enabled and its entity becomes active
当该组件可用及其实体活跃时调用。
onDisable ( )
Called when this component becomes disabled or its entity becomes inactive
当该组件禁用及其实体不活跃时调用。
onDestroy ( )
Called when this component will be destroyed.
该组件将被销毁时调用。
onFocusInEditMode ( )
onLostFocusInEditMode ( )
addComponent ( typeOrName ) Component
Adds a component class to the entity. You can also add component to entity by passing in the name of the script.
添加一个组件类的实体。您还可以将组件通过脚本的名称添加到实体。
getComponent ( typeOrName ) Component
Returns the component of supplied type if the entity has one attached, null if it doesn't. You can also get component in the entity by passing in the name of the script.
如果实体有一个连接,会返回提供的组件类型,如果没有,返回null.你也可以在实体组件通过脚本的名称获得组件。
schedule ( callback, [interval =0], [repeat =cc.REPEAT_FOREVER], [delay =0] )
Schedules a custom selector.
自定义一个选择器。
If the selector is already scheduled, then the interval parameter will be updated without scheduling it again.
如果定时器已存在,将在区间参数内不再更新.
interval:Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use scheduleUpdate() instead.
时间间隔:嘀嗒时间间隔. 0:每帧。如果interval = 0,建议使用scheduleUpdate()。
repeat:The selector will be executed (repeat + 1) times, you can use kCCRepeatForever for tick infinitely.
重复次数: 选择器执行(repeat+1)次.可以使用kCCRepeatForever来保持无限次嘀嗒。
delay:The amount of time that the first tick will wait before execution.
延时: 第一次嘀嗒后等待的时间间隔.
scheduleOnce ( callback, [delay =0] )
Schedules a callback function that runs only once, with a delay of 0 or larger.
在延时0秒或更久时间后,只执行一次回调函数。
unschedule ( callback_fn )
Unschedules a custom callback function.
取消(停止)执行一个自定义选择器回调函数。
unscheduleAllCallbacks ( )
unschedule all scheduled callback functions: custom callback functions, and the 'update' callback function.
取消(停止)执行所有选择器回调函数:自定义函数和update()函数。
Actions are not affected by this method.
Actions不被这个方法影响。
destroy ( ) Boolean
Destroy this Object, and release all its own references to other objects.
销毁这个对象,释放所有的其他对象对其的引用。
After destroy, this CCObject is not usable any more. You can use cc.isValid(obj) (or obj.isValid if obj is non-nil) to check whether the object is destroyed before accessing it.
破坏后,这个CCObject不再可用。在访问之前,您可以使用cc.isValid(obj)(或obj.isValid如果obj非nil值)检查对象是否被摧毁。
realDestroyInEditor ( )
In fact, Object's "destroy" will not trigger the destruct operation in Firebal Editor. The destruct operation will be executed by Undo system later.
实际上,对象的“摧毁”不会在Firebal编辑器引发销毁操作。销毁操作将在还原系统后执行。