pinball/assets/_Game/Scripts/Gameplay/Flipper.ts

20 lines
681 B
TypeScript

import { _decorator, Component, HingeJoint2D, Node, input, Input, EventMouse, CCFloat } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('Flipper')
export class Flipper extends Component {
@property({ visible: true, type: HingeJoint2D })
public _hingeJoint: HingeJoint2D;
@property({ visible: true, type: CCFloat })
public _motorSpeedActive: number;
@property({ visible: true, type: CCFloat })
public _motorSpeedDeActive: number;
public activeFlipper(): void {
this._hingeJoint.motorSpeed = this._motorSpeedActive;
}
public deActiveFlipper(): void {
this._hingeJoint.motorSpeed = this._motorSpeedDeActive;
}
}