Рефакторинг Player
This commit is contained in:
parent
e2717fa7ee
commit
cff5768cd8
@ -10,29 +10,30 @@ public class Player : MonoBehaviour
|
||||
|
||||
[Header("Оружие")]
|
||||
public List<Weapon> weaponsContainer;
|
||||
private int weaponIndex = 0;
|
||||
public Weapon ActiveWeapon => weaponsContainer[weaponIndex];
|
||||
|
||||
[Header("Настройки погружения")]
|
||||
[SerializeField] private Transform UpPoint;
|
||||
[SerializeField] private Transform DownPoint;
|
||||
[SerializeField] private float MaxSpeed = 5f;
|
||||
[SerializeField] private float SmoothTime = 0.5f; // Время разгона/торможения
|
||||
|
||||
private float currentHeightVelocity = 0f;
|
||||
private float totalHeight;
|
||||
public float DepthPercent => (UpPoint.position.y - transform.position.y) / totalHeight;
|
||||
|
||||
public float DepthPercentToStartPressure = 0.1f;
|
||||
public float PressureMultiplier = 0.2f;
|
||||
[Header("Давление")]
|
||||
[SerializeField] private float DepthPercentToStartPressure = 0.1f;
|
||||
[SerializeField] private float PressureMultiplier = 0.2f;
|
||||
public float PressurePercent { get; private set; }
|
||||
public float RotationAngle { get; private set; }
|
||||
|
||||
private float totalHeight = 10f;
|
||||
private int weaponIndex = 0;
|
||||
public Weapon ActiveWeapon => weaponsContainer[weaponIndex];
|
||||
[Header("Здоровье")]
|
||||
public Health HealthComponent;
|
||||
[SerializeField] private List<Hitbox> hitboxes;
|
||||
[SerializeField] private float maxHp = 500; //вариант из настроек инициализировать
|
||||
|
||||
public Transform EnemiesTarget;
|
||||
|
||||
public Health Health;
|
||||
public List<Hitbox> hitboxes;
|
||||
[Header("Прицеливание врагов")]
|
||||
[Tooltip("Точка в которую будут целиться враги")] public Transform EnemiesTarget;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -40,7 +41,7 @@ public class Player : MonoBehaviour
|
||||
|
||||
foreach (var hitbox in hitboxes)
|
||||
hitbox.Initialize(gameObject);
|
||||
Health.Initialize(1000, hitboxes);
|
||||
HealthComponent.Initialize(maxHp, hitboxes);
|
||||
}
|
||||
|
||||
void Update()
|
||||
@ -94,7 +95,7 @@ public class Player : MonoBehaviour
|
||||
ActiveWeapon.Shoot();
|
||||
}
|
||||
|
||||
public void MoveToHeight(float targetHeight)
|
||||
private void MoveToHeight(float targetHeight)
|
||||
{
|
||||
float currentY = transform.position.y;
|
||||
float newY = Mathf.SmoothDamp(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user