BattleNodeBase.ts 894 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { _decorator,Component} from 'cc';
  2. import { RenderPriority } from '../data/BattleEnum';
  3. const { ccclass, property } = _decorator;
  4. //战斗基础类
  5. @ccclass('BattleNodeBase')
  6. export class BattleNodeBase extends Component {
  7. priority: RenderPriority = RenderPriority.Role;
  8. ID: number = 0;
  9. typeID: number = 0;
  10. //是否锁定,锁定后不能做其他操作
  11. protected _isLock: boolean = false;
  12. //锁定时间 最多锁3秒
  13. protected _lockTime: number = 0;
  14. set isLock(isLock:boolean){
  15. this._isLock = isLock;
  16. this._lockTime = isLock?3:0;
  17. }
  18. get isLock(){
  19. return this._isLock;
  20. }
  21. // start() {
  22. // }
  23. update(deltaTime: number) {
  24. if(this._lockTime > 0){
  25. this._lockTime -= deltaTime;
  26. if(this._lockTime <= 0){
  27. this._isLock = false;
  28. }
  29. }
  30. }
  31. }