small changes in character script
This commit is contained in:
parent
d0ba76ee39
commit
007a2d83bf
@ -22,8 +22,8 @@ public class Character : MonoBehaviour
|
|||||||
|
|
||||||
[SerializeField] private GameObject HealthBar;
|
[SerializeField] private GameObject HealthBar;
|
||||||
|
|
||||||
private float horInpt;
|
private float horInput;
|
||||||
private float verInpt;
|
private float verInput;
|
||||||
|
|
||||||
public struct StatReturn
|
public struct StatReturn
|
||||||
{
|
{
|
||||||
@ -33,44 +33,23 @@ public struct StatReturn
|
|||||||
}
|
}
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
characterAnimator = characterSprite.GetComponent<Animator>();
|
characterAnimator = characterSprite.GetComponent<Animator>();
|
||||||
}
|
}
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (health > 240)
|
|
||||||
{
|
horInput = Input.GetAxis("Horizontal");
|
||||||
iconFull.SetActive(true);
|
verInput = Input.GetAxis("Vertical");
|
||||||
iconHalf.SetActive(false);
|
if (moveSpeed > horInput || horInput > moveSpeed)
|
||||||
iconDeath.SetActive(false);
|
|
||||||
}
|
|
||||||
if (health < 125 && health > 15)
|
|
||||||
{
|
|
||||||
iconFull.SetActive(false);
|
|
||||||
iconHalf.SetActive(true);
|
|
||||||
iconDeath.SetActive(false);
|
|
||||||
}
|
|
||||||
if (health < 15)
|
|
||||||
{
|
|
||||||
iconFull.SetActive(false);
|
|
||||||
iconHalf.SetActive(true);
|
|
||||||
iconDeath.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
print(_gameplay.GetProcentsXP());
|
|
||||||
// HealthBar.GetComponent<Image>().fillAmount = _gameplay.GetProcentsXP();
|
|
||||||
|
|
||||||
horInpt = Input.GetAxis("Horizontal");
|
|
||||||
verInpt = Input.GetAxis("Vertical");
|
|
||||||
if (moveSpeed > horInpt || horInpt > moveSpeed)
|
|
||||||
{
|
{
|
||||||
characterAnimator.SetBool("IsRun", true);
|
characterAnimator.SetBool("IsRun", true);
|
||||||
transform.position += new Vector3(horInpt * moveSpeed,0,0);
|
transform.position += new Vector3(horInput * moveSpeed,0,0);
|
||||||
if (horInpt > 0)
|
if (horInput > 0)
|
||||||
{
|
{
|
||||||
characterSprite.transform.localScale = new Vector3(1, 1, 1);
|
characterSprite.transform.localScale = new Vector3(1, 1, 1);
|
||||||
}
|
}
|
||||||
if (horInpt < 0)
|
if (horInput < 0)
|
||||||
{
|
{
|
||||||
characterSprite.transform.localScale = new Vector3(-1, 1, 1);
|
characterSprite.transform.localScale = new Vector3(-1, 1, 1);
|
||||||
}
|
}
|
||||||
@ -79,10 +58,10 @@ void Update()
|
|||||||
{
|
{
|
||||||
characterAnimator.SetBool("IsRun", false);
|
characterAnimator.SetBool("IsRun", false);
|
||||||
}
|
}
|
||||||
if (-0.1f > verInpt || verInpt > 0.1f)
|
if (-0.1f > verInput || verInput > 0.1f)
|
||||||
{
|
{
|
||||||
characterAnimator.SetBool("IsRun", true);
|
characterAnimator.SetBool("IsRun", true);
|
||||||
transform.position += new Vector3(0,verInpt * moveSpeed,0);
|
transform.position += new Vector3(0,verInput * moveSpeed,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveCamera();
|
MoveCamera();
|
||||||
|
Loading…
Reference in New Issue
Block a user