import { _decorator, Component, Tween, tween } from 'cc'
const { ccclass, property } = _decorator

import { FishPathInfo } from '../../script/game/config/FishPathInfo'
import FishManager from '../../script/game/manager/FishManager'
import { FishInfo } from '../../script/game/config/FishInfo'

@ccclass('FishBase')
export default class FishBase extends Component {
	public fishInfo: FishInfo
	public fishType: number = 1
	public blood: number = 1
	public fishPathInfo: FishPathInfo
	public isDead: boolean
	onLoad() {}
	start() {}
	public playDeadMv() {
		this.isDead = true
		this.scheduleOnce(() => {
			FishManager.instance.killFish(this)
		}, 1.5)
		tween(this.node)
			.repeatForever(tween().by(0.6, { angle: -360 }))
			.start()
	}
	onDisable() {
		//this.node.stopAllActions();
		Tween.stopAllByTarget(this.node)
		this.unscheduleAllCallbacks()
	}
}
