12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import BaseEvent from "../base/BaseEvent";
- /**
- * 复位开关
- */
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class FOpenDoorFW extends BaseEvent {
- @property({
- type:[cc.Node],
- displayName:'需要复位的节点'
- })
- mNodes: Array<cc.Node> = [];
- private pos = []
- onLoad(){
- super.onLoad()
- for (let i = 0; i < this.mNodes.length; i++) {
- const element = this.mNodes[i];
- this.pos.push(element.getPosition())
- }
- }
- onBegin(tag: number) {
- for (let i = 0; i < this.mNodes.length; i++) {
- const element = this.mNodes[i];
- let pos = this.pos[i]
- cc.tween(element).sequence(
- cc.delayTime(0.1),
- cc.callFunc(()=>{
- element.x = pos.x
- element.y = pos.y
- })
- ).start()
- }
- }
- onEnd(tag: number) {
-
- }
- }
|