Beispiel #1
0
    private void ChangeState(eCampaignCharacterState newState, bool ignoreDeath = false)
    {
        eCampaignCharacterState previousState = _state;

        _state = newState;

        if (_currentHandler != null && !_currentHandler.IsFinished)
        {
            _currentHandler.End(newState);

            CodeObjectManager.GetCharacterStateManager(_currentHandler.GetType()).Destroy(_currentHandler);
        }

        System.Type handlerType = _stateHandlers[State];

        _currentHandler = (CharacterStateHandler)CodeObjectManager.GetCharacterStateManager(handlerType).GetNext();

        _currentHandler.Controller     = _controller;
        _currentHandler.MoveController = _moveController;
        //_currentHandler.Stats = _statsComponent;
        _currentHandler.Locomotion = LocomotionComponent;
        _currentHandler.Combat     = _combatController;
        _currentHandler.ViewRPC    = _viewRPC;
        //_currentHandler.EffectReceiver = _effectReceiver;
        _currentHandler.Conditions = _conditionComponent;
        _currentHandler.Targeting  = _targetingComponent;
        _currentHandler.Character  = this;

        _currentHandler.Begin(previousState);

        _moveController.SetPlaybackSpeed(1.0f);
    }
Beispiel #2
0
    void OnDisable()
    {
        CharacterComponentManager.sCharacterComponents.Remove(this);

        if (_currentHandler != null)
        {
            _currentHandler.End(eCampaignCharacterState.Idle);
            CodeObjectManager.GetCharacterStateManager(_currentHandler.GetType()).Destroy(_currentHandler);
            _currentHandler = null;
        }
    }