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
|
||||||
{
|
{
|
||||||
@ -36,41 +36,20 @@ 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)
|
|
||||||
{
|
|
||||||
iconFull.SetActive(true);
|
|
||||||
iconHalf.SetActive(false);
|
|
||||||
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());
|
horInput = Input.GetAxis("Horizontal");
|
||||||
// HealthBar.GetComponent<Image>().fillAmount = _gameplay.GetProcentsXP();
|
verInput = Input.GetAxis("Vertical");
|
||||||
|
if (moveSpeed > horInput || horInput > moveSpeed)
|
||||||
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