public void Clear() { // 人物动画 AnimationManager.GetInstance().RemoveAnimation(_aniChar); _aniChar = null; _charAniSp.sprite = null; _charAniSp = null; _isCastingBomb = false; // B if (_bomb != null) { _bomb.Clear(); _bomb = null; } // 副武器 _subLayerTrans = null; for (int i = 0; i < _subWeapons.Length; i++) { _subWeapons[i].Clear(); } _subWeapons = null; // 销毁 GameObject.Destroy(_character); _character = null; // 判定点 GameObject.Destroy(_collisionPointTf.gameObject); _collisionPointTf = null; _rotatePointTf = null; // 状态机 _stateEnterFunc = null; _stateExitFunc = null; _stateUpdateFunc = null; }
protected virtual void OnStateNormalEnter() { _stateUpdateFunc = StateNormalUpdate; _stateExitFunc = OnStateNormalExit; UpdateCollisionData(); // 射击相关 _shootTimeAfterKeyUp = Consts.MaxShootDurationAfterKeyUp + 1; _isInputShootKey = false; _isShootAvailable = true; }
protected virtual void OnStateDyingEnter() { SoundManager.GetInstance().Play("se_pldead00", 0.1f, false, true); _dyingTime = 0; _stateUpdateFunc = StateDyingUpdate; _stateExitFunc = OnStateDyingExit; // 自机暂时消失 _character.SetActive(false); // 无敌 SetInvincible(true, 20); CommandManager.GetInstance().RunCommand(CommandConsts.PlayerDying); }
protected void UpdateState() { if (_nextState != eCharacterState.Undefined && _curState != _nextState) { OnStateExit(); _stateUpdateFunc = null; _stateExitFunc = null; _curState = _nextState; OnStateEnter(); } _stateUpdateFunc(); }