Пример #1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     //horizontalInput = Input.GetAxis("Horizontal");
     if (gControl.currentGameState == GameController.GameState.Playing)
     {
         TriToolHub.Rotate(gameObject, TriToolHub.XYZ.Y, 1 * Time.deltaTime * rotationSpeed, true, Space.World);
     }
 }
Пример #2
0
 public void Rotation()
 {
     cHorizontal           += playerControls.GetAxis("CamHorizontal") * ((invertHorizontal)?RotationSpeed:-RotationSpeed);
     cVertical             += playerControls.GetAxis("CamVertical") * ((invertVertical) ? -RotationSpeed : RotationSpeed);
     cVertical              = Mathf.Clamp(cVertical, minXAngle, maxXAngle);
     cameraRotator.position = Target.position;
     TriToolHub.CreateVector3(cVertical, cHorizontal, 1, TriToolHub.AxisPlane.XY, Target.gameObject, out rotationVector);
     //rotationVector.x = Mathf.Clamp(rotationVector.x, minXAngle, maxXAngle);
     //TriToolHub.Rotate(cameraRotator.gameObject, rotationVector, true, Space.World);
     rotationVector.z = 0;
     TriToolHub.SetRotation(cameraRotator.gameObject, rotationVector, Space.Self);
 }
Пример #3
0
    void CameraRotation()
    {
        float hAxis = player.GetAxis("Horizontal Alt");
        float vAxis = player.GetAxis("Vertical Alt");

        //TriToolHub.Rotate(gameObject, new Vector3(vAxis * rotationSpeed, hAxis*rotationSpeed, 0), true, Space.World);


        transform.RotateAround(playerGameObject.transform.position, transform.up, hAxis * rotationSpeed * Time.deltaTime);
        transform.RotateAround(playerGameObject.transform.position, transform.right, vAxis * rotationSpeed * Time.deltaTime);
        TriToolHub.SetRotation(gameObject, TriToolHub.XYZ.Z, 0, Space.World);
    }
Пример #4
0
    public void Movement()
    {
        TriToolHub.CreateVector3(horizontalAxis, verticalAxis, Speed / 10, TriToolHub.AxisPlane.XZ, (inCombat) ? gameObject : cameraObject, out mVector);
        mVector = Vector3.ClampMagnitude(mVector, Speed / 10);
        if (CurrentState == PState.Jumping)
        {
            YVelocity = Mathf.Lerp(YVelocity, JumpForce, Time.deltaTime * velocityChangeSpeed);
            mVector.y = YVelocity;
        }
        if (CurrentState == PState.Falling)
        {
            YVelocity = Mathf.Lerp(YVelocity, Gravity, Time.deltaTime * velocityChangeSpeed);
            mVector.y = YVelocity;
        }

        //TriToolHub.AddForce(gameObject, MovementVector, Space.World, ForceMode.Force);
        CharacterController.Move(mVector);
        P_AnimationHandler.SurveyorWheel();
    }
Пример #5
0
    public void Rotation()
    {
        //Vector3 tVec = CharacterController.velocity + leanVector;
        TriToolHub.SmoothLookAtDirection(playerRotator.gameObject, CharacterController.velocity, 0.01f, transform.up, true, RotationSpeed);

        Vector3    tiltAxis = Vector3.Cross(transform.up, CharacterController.velocity.normalized);
        Quaternion rot      = Quaternion.AngleAxis(leanAmount, tiltAxis);

        rot *= playerRotator.rotation;
        //TriToolHub.SetRotation(Model.gameObject, rot, Space.Self);

        //TriToolHub.SetRotation(Model.gameObject, rot, Space.World);
        if (CurrentState != PState.Idle)
        {
            Model.transform.rotation = Quaternion.Lerp(Model.transform.rotation, rot, Time.deltaTime * (RotationSpeed));
        }
        else
        {
            Model.transform.rotation = Quaternion.Lerp(Model.transform.rotation, playerRotator.rotation, Time.deltaTime * (RotationSpeed));
        }
    }
 public void MoveToMethod()
 {
     if (shouldMoveToPoint)
     {
         if (!hasReachedPoint)
         {
             TriToolHub.SmoothLookAt(gameObject, pointToReach, transform.up, true, 7);
             pointMinusY        = new Vector3(pointToReach.x, transform.position.y, pointToReach.z);
             transform.position = Vector3.MoveTowards(transform.position, pointMinusY, speed * Time.deltaTime);
         }
         if (TriToolHub.FastApproximately(Vector3.Distance(transform.position, pointMinusY), 0, movementAccuracy))
         {
             hasReachedPoint = true;
         }
         //else hasReachedPoint = false;
         RaycastHit rayInfo;
         if (Physics.SphereCast(transform.position, 5, pointMinusY, out rayInfo, fowardRayLength))
         {
             if (!rayInfo.collider.tag.Contains("Ground"))
             {
                 if (gameObject.tag.Contains("Player"))
                 {
                     if (!rayInfo.collider.tag.Contains("Player"))
                     {
                         hasReachedPoint = true;
                     }
                 }
                 //if (gameObject.tag.Contains("Enemy"))
                 //if (!rayInfo.collider.tag.Contains("Enemy"))
                 hasReachedPoint = true;
             }
         }
         else
         {
             hasReachedPoint = false;
         }
     }
 }
Пример #7
0
 void Update()
 {
     TriToolHub.Rotate(gameObject, TriToolHub.XYZ.Z, speed, true, Space.Self);
 }