add unity project for engine customization
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Data;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
[Header("Movement")]
|
||||
[SerializeField] private float speed;
|
||||
[SerializeField] private float rotationSpeed;
|
||||
|
||||
[Header("Values")]
|
||||
[SerializeField] private float maxHealth = 100.0f;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private Image healthBarFillingImage;
|
||||
|
||||
[Header("Abilities")] [SerializeField] private Ability ability;
|
||||
[SerializeField] private Ability[] abilities;
|
||||
|
||||
public float _currentHealth; // stupid public value for testing
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_currentHealth = maxHealth;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
healthBarFillingImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal,
|
||||
Mathf.Clamp01(_currentHealth / maxHealth) * 200.0f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user