38 lines
953 B
TypeScript
38 lines
953 B
TypeScript
import { Component, Tween, _decorator, tween } from 'cc'
|
|
|
|
import { FishInfo } from '../../script/game/config/FishInfo'
|
|
import { FishPathInfo } from '../../script/game/config/FishPathInfo'
|
|
import FishManager from '../../script/game/manager/FishManager'
|
|
import WsManager from '../../script/game/manager/WsManager'
|
|
|
|
const { ccclass, property } = _decorator
|
|
|
|
@ccclass('FishBase')
|
|
export default class FishBase extends Component {
|
|
public fishInfo: FishInfo
|
|
public fishType: number = 1
|
|
public fishId: string = ''
|
|
public fishPathInfo: FishPathInfo
|
|
public isDead: number = 2
|
|
|
|
onLoad() {}
|
|
|
|
start() {}
|
|
|
|
// 播放死亡动画
|
|
public playDeadMv(res: any) {
|
|
this.isDead = 1
|
|
this.scheduleOnce(() => {
|
|
FishManager.instance.killFish(res)
|
|
}, 1)
|
|
tween(this.node)
|
|
.repeatForever(tween().by(0.6, { angle: -360 }))
|
|
.start()
|
|
}
|
|
|
|
onDisable() {
|
|
Tween.stopAllByTarget(this.node)
|
|
this.unscheduleAllCallbacks()
|
|
}
|
|
}
|