Added lots of examples for editor customization
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using Attributes;
|
||||
using Data;
|
||||
using Events;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Player
|
||||
{
|
||||
[RequireComponent(typeof(CharacterController))]
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
[Header("Events")]
|
||||
[SerializeField, Required] private EventBroker eventBroker;
|
||||
|
||||
[Header("Movement")]
|
||||
[SerializeField] private float speed = 5f;
|
||||
[SerializeField] private float rotationSpeed = 60f;
|
||||
|
||||
[Header("Values")]
|
||||
// [SerializeField] private float maxHealth = 100f;
|
||||
[SerializeField, Required] private FloatValue maxHealth;
|
||||
[SerializeField, Required] private FloatValue currentHealth;
|
||||
[SerializeField] private CharacterAttributes characterAttributes;
|
||||
|
||||
// [Header("References")]
|
||||
// [SerializeField] private Image healthBarFillingImage;
|
||||
|
||||
[Header("Abilities")]
|
||||
[SerializeField] private Ability ability;
|
||||
[SerializeField] private Ability[] abilities;
|
||||
|
||||
|
||||
// private float _currentHealth;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// _currentHealth = maxHealth;
|
||||
|
||||
// set health
|
||||
currentHealth.Value = maxHealth.Value;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// healthBarFillingImage.fillAmount = _currentHealth / maxHealth;
|
||||
|
||||
if (currentHealth.Value <= 0.0f) eventBroker.RaisePlayerDied();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user