Added Animations. Changed inspector view for navpoints. A lot of fixes. Changed project structure.

This commit is contained in:
2022-05-09 21:31:21 +07:00
parent 6aa872c92f
commit d617ddabe7
166 changed files with 28460 additions and 2197 deletions

View File

@ -0,0 +1,61 @@
using System;
using Unity.Mathematics;
using UnityEngine;
namespace CameraScripts
{
public class CameraHandler : MonoBehaviour
{
public Transform targetTransform;
public Transform cameraTransform;
public Transform cameraPivotTransform;
private Transform _myTransform;
private Vector3 _cameraTransformPosition;
private LayerMask ignoreLayers = ~(1 << 8 | 1 << 9 | 1 << 10);
public static CameraHandler Singleton;
public const float LookSpeed = 0.1f;
public const float FollowSpeed = 0.1f;
public const float PivotSpeed = 0.03f;
private float _defaultPosition;
private float _lookAngle;
private float _pivotAngle;
public float minimumPivot = -35;
public float maximumPivot = 35;
private void Awake()
{
Application.targetFrameRate = 60;
Singleton = this;
_myTransform = transform;
_defaultPosition = _myTransform.localPosition.z;
}
public void TargetPosition(float delta)
{
var toTargetPosition = Vector3.Lerp(_myTransform.position, targetTransform.position, delta /FollowSpeed);
_myTransform.position = toTargetPosition;
}
public void HandleCameraRotation(float delta, float mouseX, float mouseY)
{
_lookAngle += (mouseX * LookSpeed) / delta;
_pivotAngle -= (mouseY * PivotSpeed) / delta;
_pivotAngle = Mathf.Clamp(_pivotAngle, minimumPivot, maximumPivot);
var rotation = Vector3.zero;
rotation.y = _lookAngle;
var targetRotation = Quaternion.Euler(rotation);
_myTransform.rotation = targetRotation;
rotation = Vector3.zero;
rotation.x = _pivotAngle;
targetRotation = Quaternion.Euler(rotation);
cameraPivotTransform.localRotation = targetRotation;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3d606407023147d7b4d530a9593e9697
timeCreated: 1652086288