public void FixedUpdate()
        {
            if (X8Animator != null)
            {
                StateInfo = X8Animator.GetCurrentAnimatorStateInfo(0);
                CheckPhaseStrike();
                CheckTackle();
                CheckShoot();
                CheckStrafe();
                CheckPlayerThrowingBall();
                CheckedChargedRun();
            }


            ReadyToScore();
            if (EnemyAI != null)
            {
                EnemyAI_Movement();
            }

            if (TackleTimer.IsEnabled)
            {
                TackleTimer.IncrementTimer();
            }

            if (ShootTimer.IsEnabled)
            {
                ShootTimer.IncrementTimer();

                float angle = CentralHub.VectorToAngle(CameraFocus.transform.position - this.transform.position);
                angle = CentralHub.AdjustAngle(angle);
                FaceMe(angle); //face the player in the direction he will shoot for short timer
                //   PlayerAttackState = AttackMode.IsFiringAbility; //we are shooting
            }
        }
        //!checks to see if the player is shooting
        public bool CheckShoot()
        {
            AnimatorStateInfo Layer2State = X8Animator.GetCurrentAnimatorStateInfo(1);

            if (Layer2State.IsName("Shoot"))
            {
                dampin            = .55f;//slow down the rotation player movement for accuate shooting
                PlayerAttackState = AttackMode.IsFiringAbility;
                //if we are ready to score focus on goal point
                if (ReadyToScore()) //
                {
                    // _myCamera.transform.LookAt(CurrentGoalTarget.transform.position);
                }
                else
                {
                    ScoreMode = true;
                }

                float angle = CentralHub.VectorToAngle(CameraFocus.transform.position - this.transform.position);
                angle = CentralHub.AdjustAngle(angle);
                FaceMe(angle);
            }
            else
            {
                PlayerAttackState = AttackMode.NotFiringAbility;
                dampin            = 1; //resume normal shooting
            }


            return(false);
        } //end of medthod
        //! this medthod takes in an angle parameter, rotates by the degress parameter, and returns the vector version of the rotated angle
        Vector3 RotateAngleCreateVector(float oldangle, int degrees)
        {
            Vector3 RoatedAngleVector = Vector3.zero;                               //create a vector
            float   angle             = CentralHub.AdjustAngle(oldangle + degrees); //rotated the old passed angle by degrees and make sure the angle wrap correctly

            RoatedAngleVector.x = PlayerToCameraLength * CentralHub.COS[(int)angle * CentralHub.SIN.IndexJump + (int)(CameraThetaOffest * CentralHub.SIN.IndexJump)] * CentralHub.SIN[(int)ThePlayer.p_fCameraAnglePhi * CentralHub.SIN.IndexJump + (int)(CameraPhiOffest * CentralHub.SIN.IndexJump)];
            RoatedAngleVector.y = 0;                                                                                                                                                                                                                                                                    // PlayerToCameraLength * CentralHub.COS[(int)ThePlayer.p_fCameraAnglePhi * CentralHub.SIN.IndexJump + (int)(CameraPhiOffest * CentralHub.SIN.IndexJump)];
            RoatedAngleVector.z = PlayerToCameraLength * CentralHub.SIN[(int)angle * CentralHub.SIN.IndexJump + (int)(CameraThetaOffest * CentralHub.SIN.IndexJump)] * CentralHub.SIN[(int)ThePlayer.p_fCameraAnglePhi * CentralHub.SIN.IndexJump + (int)(CameraPhiOffest * CentralHub.SIN.IndexJump)]; //(oldZ * CosComponent - oldX * SinComponent)

            return(RoatedAngleVector.normalized);                                                                                                                                                                                                                                                       //return the absolute direction
        }
        /**!Move the player in the given direction
         * \param LeftStickXAxis the x direction that the player will move in (supplied by the joy stick movement)
         * \param LeftStickYAxis the y direction that the player will move in (supplied by the joy stick movement)
         * \param velocity the velocity that the player will travel at
         * \param strafDirection direction the direction the player will straf in*/
        public void MovePlayer(float LeftStickXAxis, float LeftStickYAxis, float velocity, float strafDirection)
        {
            //This is the Dert
            Vector3 DestinationVector = new Vector3(LeftStickXAxis, 0, LeftStickYAxis);

            p_fDestinationAngle = CentralHub.VectorToAngle(DestinationVector);

            //  CharacterDrawLine.SetPosition(1, this.transform.position + DestinationVector);
            p_fDestinationAngle += strafDirection;
            p_fDestinationAngle  = CentralHub.AdjustAngle(p_fDestinationAngle);

            //Point direction is the direction that we want to head
            float ControllerDifference = p_fDestinationAngle - 90;


            Vector3 Destination    = CameraFocus.transform.position - _myCamera.transform.position; //new Vector3 (CentralHub.COS[(int)(CameraDirection)], 0, CentralHub.SIN[(int)(CameraDirection)]);
            float   angle          = CentralHub.VectorToAngle(Destination);
            float   angleFloatPart = 0;
            int     IntegerAngle   = 0;

            //add the offset that of where the controller is facing
            angle += ControllerDifference;
            //make sure the angle is at the correct value
            angle          = CentralHub.AdjustAngle(angle);
            IntegerAngle   = (int)angle;
            angleFloatPart = angle - (int)angle;



            float arrayoffset = (CentralHub.COS.Offsetslookup[(int)(angleFloatPart * CentralHub.COS.IndexJump)]);


            p_v3PlayerVectorDirection = new Vector3(CentralHub.COS[IntegerAngle * CentralHub.COS.IndexJump + (int)(arrayoffset * CentralHub.COS.IndexJump)], 0, CentralHub.SIN[IntegerAngle * CentralHub.COS.IndexJump + (int)(arrayoffset * CentralHub.COS.IndexJump)]);
            // PlayerDirectionalData(1.5f * CentralHub.COS[(int)angle], 1.5f * CentralHub.SIN[(int)angle]);


            if (PlayerAttackState != AttackMode.IsFiringAbility && ShootTimer.IsEnabled == false)
            {
                Debug.Log("Turning ");
                FaceThePlayer(angle, 0, p_fOrientationAngle);
            }

            this.transform.position        += p_v3PlayerVectorDirection * velocity;
            CameraFocus.transform.position += p_v3PlayerVectorDirection * velocity;
        }
        /** Start the initialization of variable */
        void Start()
        {
            TheBall = FindObjectOfType <RaydraCellz>(); //find the RaydraCell in the scene editor
            GameObject ControlHub = GameObject.Find("ControlHub");

            ShootPoint = GameObject.FindGameObjectWithTag("ShootPoint");
            // GoalSphere =GameObject.FindGameObjectWithTag("GoalPoint");


            //Get the line rendered that is attached to this game object
            LineRenderer[] CameraDrawLineArray = CameraOrientationDrawLine.GetComponents <LineRenderer>();
            LineRenderer[] PlayerDrawLineArray = PlayerOrientationDrawLine.GetComponents <LineRenderer>();
            //OrientationDrawLine = OrientationDrawLineArray[0];
            //GetComponent<Animator>() returns and array, so we are just grabbing the first element
            X8Animator = this.GetComponents <Animator>()[0];


            if (CameraOrientationDrawLine == null)//return null if there is problem
            {
                return;
            }

            //if(CameraDrawLine == null

            CharacterDrawLine = PlayerDrawLineArray[0];
            CharacterDrawLine.SetPosition(0, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z));
            CharacterDrawLine.SetPosition(1, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + 1));


            CameraDrawLine = CameraDrawLineArray[0];
            CameraDrawLine.SetPosition(0, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z));
            CameraDrawLine.SetPosition(1, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + 1));



            CharacterDrawLine.SetWidth(.05f, .05f);

            CameraDrawLine.SetWidth(.05f, .05f);

            Hub       = ControlHub.GetComponent <CentralHub>();
            ThePlayer = GetComponent <RaydraPlayerz>(); //new RaydraPlayer (this.gameObject);

            ThePlayer.MyCamera.transform.LookAt(CameraFocus.transform.position, CameraFocus.transform.up);
            //initial the camera to the focus point vector
            PlayerDrawLineVector = ThePlayer.p_v3PlayerToFocusVect = ThePlayer.MyCamera.transform.position - CameraFocus.transform.position;

            //initialize the camera to the player
            ThePlayer.p_v3PlayerToCameraVect = CameraFocusOverHead.transform.position - ThePlayer.MyCamera.transform.position;


            //get the length of the camera to focus point vector
            PlayerToFocusLength = Math.Abs(ThePlayer.p_v3PlayerToFocusVect.magnitude);

            //get the length of player to the camera
            PlayerToCameraLength = Math.Abs(ThePlayer.p_v3PlayerToCameraVect.magnitude);

            ThePlayer.p_fCameraAnglePhi   = Vector3.Angle(new Vector3(0, 1, 0), ThePlayer.p_v3PlayerToCameraVect);
            ThePlayer.p_fCameraAngleTheta = Vector3.Angle(new Vector3(1, 0, 0), ThePlayer.p_v3PlayerToCameraVect);

            ThePlayer.p_fCameraAnglePhi   = (int)ThePlayer.p_fCameraAnglePhi;
            ThePlayer.p_fCameraAngleTheta = (int)ThePlayer.p_fCameraAngleTheta;

            ThePlayer.p_fPlayerToFocusAnglePhi   = (int)Vector3.Angle(new Vector3(0, 1, 0), ThePlayer.p_v3PlayerToFocusVect);
            ThePlayer.p_fPlayerToFocusAngleTheta = (int)Vector3.Angle(new Vector3(1, 0, 0), ThePlayer.p_v3PlayerToFocusVect);



            if (ThePlayer.p_v3PlayerToFocusVect.z < 0)
            {
                ThePlayer.p_fPlayerToFocusAngleTheta = 360 - ThePlayer.p_fPlayerToFocusAngleTheta; //make sure that the angle is at the correct corridinate
            }
            if (ThePlayer.p_v3PlayerToCameraVect.z < 0)
            {
                ThePlayer.p_fCameraAngleTheta = 360 - ThePlayer.p_fCameraAngleTheta; //make sure that the angle is at the correct corridinate
            }
            //The player orientation or direction the player is walking  is always the direction that the camera is looking.
            PlayerDrawLineVector.y = originalY;
            PlayerDrawLineVector.x = originalX;
            PlayerDrawLineVector.z = originalZ;

            InitialHorizontalControllerPosition1 = Input.GetAxis("RightHorizontal"); //give the initial Horizontal poistion
            InitialVerticalControllerPosition1   = Input.GetAxis("RightVertical");
            InitialHorizontalControllerPosition0 = Input.GetAxis("LeftHorizontal");  //give the initial Horizontal poistion
            InitialVerticalControllerPosition0   = Input.GetAxis("RightVertical");


            X8Animator.SetFloat("Speed", 0);
            X8Animator.SetBool("Jump", false);
            X8Animator.SetBool("RunJump", false);
            X8Animator.SetBool("Tackle", false);
            X8Animator.SetBool("Shoot", false);
            X8Animator.SetBool("ThrowBall", false);
            X8Animator.SetBool("ChargedRun", false);
            X8Animator.SetBool("StrafeRight", false);
            X8Animator.SetBool("StrafeLeft", false);
            X8Animator.SetBool("WeaponCharged", false);

            StateInfo = X8Animator.GetCurrentAnimatorStateInfo(0);

            ThePlayer.pRidgidBody = GetComponent <Rigidbody>();

            ThePlayer.p_Collider = GetComponent <CapsuleCollider>();//get a reference to the first collider connected to this object

            turnSpeed = 2;

            InitialStrafeAxisValue = .16f;

            InitialRightFlipperValue = -.05f;                  //this is initail value of the right pressure button
            InitialLeftFlipperValue  = InitialStrafeAxisValue; //this is initail value of the right pressure button


            ThePlayer.MyCamera.transform.LookAt(CameraFocus.transform.position, Vector3.up);
        }