Example #1
0
 private void GetPlayerScript()
 {
     //_playerMove = transform.GetComponent<PlayerMove>();
     _playerStatus    = this.GetComponent <PlayerStatus>();
     _playerToolsBase = this.GetComponent <PlayerToolsBase>();
     _playerInfo      = this.GetComponent <PlayerInfo>();
     //_thirdPersonCharacter_WSM = this.GetComponent<ThirdPersonCharacter_WSM>();
     _testToolsManagers = this.GetComponent <TestToolsManagers>();
     _motionController  = this.GetComponent <com.ootii.Actors.AnimationControllers.MotionController>();
     //_leftBackpackController = _leftHandController.transform.Find("RadialMenu/RadialMenuUI/Panel").GetComponent<BackpackController>();
     //_rightBackpackController = _rightHandController.transform.Find("RadialMenu/RadialMenuUI/Panel").GetComponent<BackpackController>();
 }
        /// <summary>
        /// Used to determine if the motor should activate
        /// </summary>
        /// <param name="rActiveMotor">Current active motor</param>
        /// <returns></returns>
        public override bool TestActivate(CameraMotor rActiveMotor)
        {
            UpdateToggle();

            if (!_IsEnabled)
            {
                return(false);
            }

            if (_LimitToStart && RigController.ActiveMotorIndex != _StartMotorIndex)
            {
                return(false);
            }

            bool lActivate = false;

            // Priority activation
            //if (!_LimitToStart || RigController.ActiveMotorIndex == _StartMotorIndex)
            {
                if (_ActionAlias.Length > 0 && RigController.InputSource != null)
                {
                    if (_ActionAliasEventType == 0)
                    {
                        if (RigController.InputSource.IsJustPressed(_ActionAlias) || (mIsActionAliasInUse && !mWasActionAliasInUse))
                        {
                            lActivate = true;
                        }
                        else if (_LimitToStart && RigController.InputSource.IsPressed(_ActionAlias))
                        {
                            lActivate = true;
                        }
                    }
                    else if (_ActionAliasEventType == 1)
                    {
                        if (RigController.InputSource.IsJustReleased(_ActionAlias) || (!mIsActionAliasInUse && mWasActionAliasInUse))
                        {
                            lActivate = true;
                        }
                    }
                }
            }

            // Priority activation
            if (!lActivate && TestDistance && RigController.ActiveMotor != null)
            {
                if (DistanceCompareType == 0)
                {
                    if (RigController.ActiveMotor.Distance < DistanceValue)
                    {
                        lActivate = true;
                    }
                }
                else if (DistanceCompareType == 1)
                {
                    if (RigController.ActiveMotor.Distance > DistanceValue)
                    {
                        lActivate = true;
                    }
                }
                else
                {
                    if (Mathf.Abs(RigController.ActiveMotor.Distance - DistanceValue) < 0.001f)
                    {
                        lActivate = true;
                    }
                }
            }

#if OOTII_MC
            // Activation limiters
            if (lActivate)
            {
                if (mActorStances != null && mActorStances.Count > 0 && RigController.CharacterController != null)
                {
                    lActivate = false;

                    GameObject lGameObject = RigController.CharacterController.gameObject;

                    com.ootii.Actors.AnimationControllers.MotionController lMotionController = lGameObject.GetComponent <com.ootii.Actors.AnimationControllers.MotionController>();
                    if (lMotionController != null)
                    {
                        int lStance = lMotionController.Stance;
                        if (mActorStances.Contains(lStance))
                        {
                            lActivate = true;
                        }
                    }
                }
            }
            // See if we need to activate because we are no longer in a valid actor stance we should be in
            else if (_InvertVerifyActorStances && mActorStances != null && mActorStances.Count > 0 && RigController.CharacterController != null)
            {
                // Only do it if we are in the start motor
                //if (!_LimitToStart || RigController.ActiveMotorIndex == _StartMotorIndex)
                {
                    GameObject lGameObject = RigController.CharacterController.gameObject;

                    // Only do it if we are not in a required stance
                    com.ootii.Actors.AnimationControllers.MotionController lMotionController = lGameObject.GetComponent <com.ootii.Actors.AnimationControllers.MotionController>();
                    if (lMotionController != null)
                    {
                        int lStance = lMotionController.Stance;
                        if (!mActorStances.Contains(lStance))
                        {
                            lActivate = true;
                        }
                    }
                }
            }
#endif

            return(lActivate);
        }