39 lines
969 B
JavaScript
39 lines
969 B
JavaScript
cc.Class( {
|
|
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
_time: 0,
|
|
},
|
|
|
|
// 编辑器特性
|
|
editor: {
|
|
|
|
// 允许当前组件在编辑器模式下运行
|
|
executeInEditMode: false,
|
|
|
|
// requireComponent 参数用来指定当前组件的依赖组件
|
|
requireComponent: cc.RenderComponent,
|
|
|
|
// 当本组件添加到节点上后,禁止同类型(含子类)的组件再添加到同一个节点,防止逻辑发生冲突
|
|
disallowMultiple: true,
|
|
|
|
// menu 用来将当前组件添加到组件菜单中,方便用户查找
|
|
menu: "着色器/shader.flash 闪光",
|
|
|
|
},
|
|
|
|
// 载入
|
|
onLoad: function() {
|
|
this.rc = this.node.getComponent( cc.RenderComponent );
|
|
},
|
|
|
|
update: function( dt ) {
|
|
this.rc.getMaterial( 0 ).setProperty( 'Time', this._time );
|
|
if ( this._time > 65535 ) {
|
|
this._time = 0;
|
|
}
|
|
this._time += dt;
|
|
},
|
|
} );
|