крупный рефакторинг
This commit is contained in:
parent
a51631152b
commit
d4768d590b
@ -1,10 +1,8 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
|
||||||
using UnityEngine.InputSystem;
|
|
||||||
|
|
||||||
namespace RootMotion
|
namespace RootMotion
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CameraController : MonoBehaviour
|
public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -31,7 +29,7 @@ namespace RootMotion
|
|||||||
public float yMinLimit = -20; // Min vertical angle
|
public float yMinLimit = -20; // Min vertical angle
|
||||||
public float yMaxLimit = 80; // Max vertical angle
|
public float yMaxLimit = 80; // Max vertical angle
|
||||||
public bool rotateAlways = true; // Always rotate to mouse?
|
public bool rotateAlways = true; // Always rotate to mouse?
|
||||||
|
|
||||||
[Header("Distance")]
|
[Header("Distance")]
|
||||||
public float distance = 10.0f; // The current distance to target
|
public float distance = 10.0f; // The current distance to target
|
||||||
public float minDistance = 4; // The minimum distance to target
|
public float minDistance = 4; // The minimum distance to target
|
||||||
@ -59,7 +57,7 @@ namespace RootMotion
|
|||||||
private Vector3 lastUp;
|
private Vector3 lastUp;
|
||||||
|
|
||||||
//Rotation
|
//Rotation
|
||||||
|
|
||||||
public void SetAngles(Quaternion rotation)
|
public void SetAngles(Quaternion rotation)
|
||||||
{
|
{
|
||||||
Vector3 euler = rotation.eulerAngles;
|
Vector3 euler = rotation.eulerAngles;
|
||||||
@ -85,10 +83,10 @@ namespace RootMotion
|
|||||||
|
|
||||||
cam = GetComponent<Camera>();
|
cam = GetComponent<Camera>();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected virtual void Update()
|
protected virtual void Update()
|
||||||
{
|
{
|
||||||
@ -131,7 +129,7 @@ namespace RootMotion
|
|||||||
// delta rotation
|
// delta rotation
|
||||||
if (rotate)
|
if (rotate)
|
||||||
{
|
{
|
||||||
// var _pass = _rotate.Player.CameraRotation.ReadValue<Vector2>();
|
// var _pass = _rotate.Player.CameraRotation.ReadValue<Vector2>();
|
||||||
//x += _pass.normalized.x;
|
//x += _pass.normalized.x;
|
||||||
//y = ClampAngle(y +_pass.normalized.y * rotationSensitivity, yMinLimit, yMaxLimit);
|
//y = ClampAngle(y +_pass.normalized.y * rotationSensitivity, yMinLimit, yMaxLimit);
|
||||||
}
|
}
|
||||||
@ -152,15 +150,15 @@ namespace RootMotion
|
|||||||
|
|
||||||
// Rotation
|
// Rotation
|
||||||
//rotation = Quaternion.AngleAxis(x, Vector3.up) * Quaternion.AngleAxis(y, Vector3.right);
|
//rotation = Quaternion.AngleAxis(x, Vector3.up) * Quaternion.AngleAxis(y, Vector3.right);
|
||||||
|
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
// Distance
|
// Distance
|
||||||
distance += (distanceTarget - distance) * zoomSpeed * deltaTime;
|
distance += (distanceTarget - distance) * zoomSpeed * deltaTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//transform.rotation = rotation;
|
//transform.rotation = rotation;
|
||||||
|
@ -18,8 +18,8 @@ public class Starter : MonoBehaviour
|
|||||||
{
|
{
|
||||||
_timer.text = _starter.ToString();
|
_timer.text = _starter.ToString();
|
||||||
|
|
||||||
_dontMovePlayer1.enabled = false;
|
_dontMovePlayer1.DeactivateInput();
|
||||||
_dontMovePlayer2.enabled = false;
|
_dontMovePlayer2.DeactivateInput();
|
||||||
|
|
||||||
_borders.enabled = true;
|
_borders.enabled = true;
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ public class Starter : MonoBehaviour
|
|||||||
if (_timer != null)
|
if (_timer != null)
|
||||||
{
|
{
|
||||||
Destroy(_timer.gameObject);
|
Destroy(_timer.gameObject);
|
||||||
_dontMovePlayer1.enabled = true;
|
_dontMovePlayer1.ActivateInput();
|
||||||
_dontMovePlayer2.enabled = true;
|
_dontMovePlayer2.ActivateInput();
|
||||||
_borders.enabled = false;
|
_borders.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user