void Start()
        {
            GameObject playerCharacter = GameObject.FindWithTag("PlayerCharacter") as GameObject;

            if (null != playerCharacter)
            {
                _anim = playerCharacter.GetComponent <Animator>();
            }
            if (null != playerCharacter)
            {
                _movementTransitionManagerScript = playerCharacter.GetComponent <MovementTransitionManager>();
            }
            if (null != playerCharacter)
            {
                _playerControllerScript = playerCharacter.GetComponent <PlayerController>();
            }
            GameObject fallingPanel = GameObject.FindWithTag("Falling Panel") as GameObject;

            if (null != fallingPanel)
            {
                _fallPadScript = fallingPanel.GetComponent <FallPad>();
            }

            if (null == _anim)
            {
                Debug.LogError("FallMovementModule.Start: _anim is null.");
            }
            if (null == _movementTransitionManagerScript)
            {
                Debug.LogError("FallMovementModule.Start: _movementTransitionManagerScript is null.");
            }
            if (null == _playerControllerScript)
            {
                Debug.LogError("FallMovementModule.Start: _entityControllerScript is null.");
            }
            if (null == _fallPadScript)
            {
                Debug.LogError("FallMovementModule.Start: _fallPadScript is null.");
            }

            if (null == _anim)
            {
                return;
            }
            if (null == _movementTransitionManagerScript)
            {
                return;
            }
            if (null == _playerControllerScript)
            {
                return;
            }
            if (null == _fallPadScript)
            {
                return;
            }

            _movementTransitionManagerScript.Register(this);
        }
Example #2
0
        // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
        override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            GameObject playerCharacter = GameObject.FindWithTag("PlayerCharacter") as GameObject;

            if (null != playerCharacter)
            {
                MovementTransitionManager movementTransitionManagerScript = playerCharacter.GetComponent <MovementTransitionManager>();
                if (null != movementTransitionManagerScript)
                {
                    movementTransitionManagerScript.TransitionFromComplete();
                }
            }
        }
        // Use this for initialization
        void Start()
        {
            GameObject playerCharacter = GameObject.FindWithTag("PlayerCharacter") as GameObject;

            if (null != playerCharacter)
            {
                _anim = playerCharacter.GetComponent <Animator>();
            }
            if (null != playerCharacter)
            {
                _movementTransitionManagerScript = playerCharacter.GetComponent <MovementTransitionManager>();
            }
            if (null != playerCharacter)
            {
                _rigidBody = playerCharacter.GetComponent <Rigidbody>();
            }
            GameObject climbPad = GameObject.FindWithTag("ClimbPad") as GameObject;

            if (null != climbPad)
            {
                _climbPadScript = climbPad.GetComponent <ClimbPad>();
            }
            if (null != climbPad)
            {
                _keyboardScript = climbPad.GetComponent <Keyboard>();
            }
            _climbingPanel = GameObject.FindWithTag("ClimbingPanel") as GameObject;

            if (null == _anim)
            {
                Debug.LogError("ClimbMovementModule.Start: _anim is null.");
            }
            if (null == _movementTransitionManagerScript)
            {
                Debug.LogError("ClimbMovementModule.Start: _movementTransitionManagerScript is null.");
            }
            if (null == _rigidBody)
            {
                Debug.LogError("ClimbMovementModule.Start: _rigidBody is null.");
            }
            if (null == _climbPadScript)
            {
                Debug.LogError("ClimbMovementModule.Start: _climbPadScript is null.");
            }
            if (null == _climbingPanel)
            {
                Debug.LogError("ClimbMovementModule.Start: _climbingPanel is null.");
            }
            if (null == _keyboardScript)
            {
                Debug.LogError("ClimbMovementModule.Start: _keyboardScript is null.");
            }

            if (null == _anim)
            {
                return;
            }
            if (null == _movementTransitionManagerScript)
            {
                return;
            }
            if (null == _rigidBody)
            {
                return;
            }
            if (null == _climbPadScript)
            {
                return;
            }
            if (null == _climbingPanel)
            {
                return;
            }
            if (null == _keyboardScript)
            {
                return;
            }

            CurrentMove    = new ClimbMove(DirectionType.None, ClimbType.None);
            CurrentVector  = ConvertForClimbing(Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero));
            PreviousMove   = new ClimbMove(DirectionType.None, ClimbType.None);
            PreviousVector = ConvertForClimbing(Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero));
            Speed          = 0.0f;
            _moduleActive  = false;
            _movementTransitionManagerScript.Register(this);
            _climbPadScript.HideClimbingUI();
        }
        // Use this for initialization
        void Start()
        {
            GameObject playerCharacter = GameObject.FindWithTag("PlayerCharacter") as GameObject;

            if (null != playerCharacter)
            {
                Anim = playerCharacter.GetComponent <Animator>();
            }
            if (null != playerCharacter)
            {
                MovementTransitionManagerScript = playerCharacter.GetComponent <MovementTransitionManager>();
            }
            GameObject movementPad = GameObject.FindWithTag("MovementPad") as GameObject;

            if (null != movementPad)
            {
                MovementPadScript = movementPad.GetComponent <MovementPad>();
            }
            if (null != movementPad)
            {
                KeyboardScript = movementPad.GetComponent <Keyboard>();
            }
            speedBar = GameObject.FindWithTag("SpeedBar") as GameObject;
            GameObject speedBarKnob = GameObject.FindWithTag("SpeedBarKnob") as GameObject;

            if (null != speedBarKnob)
            {
                SpeedBarScript = speedBarKnob.GetComponent <SpeedBar>();
            }

            if (null == Anim)
            {
                Debug.LogError("SimpleMovementModule.Start: Anim is null.");
            }
            if (null == MovementTransitionManagerScript)
            {
                Debug.LogError("SimpleMovementModule.Start: MovementTransitionManagerScript is null.");
            }
            if (null == MovementPadScript)
            {
                Debug.LogError("SimpleMovementModule.Start: MovementPadScript is null.");
            }
            if (null == KeyboardScript)
            {
                Debug.LogError("SimpleMovementModule.Start: KeyboardScript is null.");
            }
            if (null == speedBar)
            {
                Debug.LogError("SimpleMovementModule.Start: speedBar is null.");
            }
            if (null == SpeedBarScript)
            {
                Debug.LogError("SimpleMovementModule.Start: SpeedBarScript is null.");
            }

            if (null == Anim)
            {
                return;
            }
            if (null == MovementTransitionManagerScript)
            {
                return;
            }
            if (null == MovementPadScript)
            {
                return;
            }
            if (null == KeyboardScript)
            {
                return;
            }
            if (null == speedBar)
            {
                return;
            }
            if (null == SpeedBarScript)
            {
                return;
            }


            CurrentMove    = new Move(DirectionType.None, (float)MovementType.Standing);
            CurrentVector  = Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero);
            PreviousMove   = new Move(DirectionType.None, (float)MovementType.Standing);
            PreviousVector = Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero);
            moduleActive   = false;
            MovementTransitionManagerScript.Register(this);
        }