import { TankBettle } from "../data/TankBattleGameData" ; import { TankBettleTankEnemy , TankBettleTankPlayer } from "./TankBattleTank" ; import TankBattleMap from "./TankBattleMap" ; const { ccclass , property } = cc . _decorator ; @ ccclass export default class TankBattleProps extends cc . Component { public type : TankBettle . PropsType = null ; onLoad ( ) { let time = TankBettle . PROPS_DISAPPEAR ; cc . tween ( this . node ) . delay ( time - 3 ) . blink ( 3 , 5 ) . call ( ( ) => { this . node . removeFromParent ( ) ; this . node . destroy ( ) ; } ) . start ( ) ; } description param other private onCollisionEnter ( other , me ) { if ( other . node . group == TankBettle . GROUP . Player ) { let player = other . node . getComponent ( TankBettleTankPlayer ) ; if ( player ) { if ( this . type == TankBettle . PropsType . LIVE ) { TankBettle . gameData . addPlayerLive ( player . isOnePlayer ) ; } else if ( this . type == TankBettle . PropsType . BOOM_ALL_ENEMY ) { TankBettle . gameData . gameMap . removeAllEnemy ( ) ; } else if ( this . type == TankBettle . PropsType . GOD ) { player . addStatus ( TankBettle . PLAYER_STATUS . PROTECTED ) ; } else if ( this . type == TankBettle . PropsType . STRONG_BULLET ) { player . addStatus ( TankBettle . PLAYER_STATUS . STRONG ) ; } else if ( this . type == TankBettle . PropsType . STRONG_MY_SELF ) { player . addLive ( ) ; } else if ( this . type == TankBettle . PropsType . TIME ) { TankBettle . gameData . addGameTime ( ) ; } this . node . stopAllActions ( ) ; this . node . removeFromParent ( ) ; this . node . destroy ( ) ; } } } description param other private onCollisionStay ( other , me ) { } description param other private onCollisionExit ( other , me ) { } private removeSelf ( ) { this . node . removeFromParent ( ) ; this . node . destroy ( ) ; } }