they call me the UI designer (and i'm being real this time)
This commit is contained in:
parent
d6da52fd69
commit
2ca43ec836
11 changed files with 1192 additions and 298 deletions
|
|
@ -4,8 +4,7 @@ using UnityEngine;
|
|||
|
||||
public class AbilityHotbarIcon : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject overlay;
|
||||
[SerializeField] private TextMeshProUGUI cooldownText;
|
||||
[SerializeField] private Transform cooldownBar;
|
||||
[SerializeField] private TextMeshProUGUI text;
|
||||
private bool onCooldown;
|
||||
private PlayerAbility thisAbility;
|
||||
|
|
@ -14,11 +13,10 @@ public class AbilityHotbarIcon : MonoBehaviour
|
|||
{
|
||||
if (onCooldown)
|
||||
{
|
||||
cooldownText.text = thisAbility.currentCooldown.ToString("F2");
|
||||
cooldownBar.localScale = new Vector3(Math.Clamp(1 - thisAbility.currentCooldown/thisAbility.cooldown, 0, 1), 1, 1);
|
||||
if (thisAbility.currentCooldown <= 0)
|
||||
{
|
||||
onCooldown = false;
|
||||
overlay.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +26,6 @@ public class AbilityHotbarIcon : MonoBehaviour
|
|||
if (thisAbility.currentCooldown > 0)
|
||||
{
|
||||
onCooldown = true;
|
||||
overlay.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ public class Entity : MonoBehaviour
|
|||
|
||||
protected void FlipSprite(Vector2 lookDirection)
|
||||
{
|
||||
if (lookDirection.x < 0f && isFacingRight)
|
||||
if (lookDirection.x > 0f && isFacingRight)
|
||||
{
|
||||
sprite.flipX = true;
|
||||
isFacingRight = !isFacingRight;
|
||||
}
|
||||
else if (lookDirection.x > 0f && !isFacingRight)
|
||||
else if (lookDirection.x < 0f && !isFacingRight)
|
||||
{
|
||||
sprite.flipX = false;
|
||||
isFacingRight = !isFacingRight;
|
||||
|
|
@ -37,6 +37,7 @@ public class Entity : MonoBehaviour
|
|||
if (!stalled)
|
||||
{
|
||||
rb.linearVelocity = moveDirection * speed;
|
||||
FlipSprite(moveDirection);
|
||||
}
|
||||
}
|
||||
public virtual void TakeDamage(float damage, Entity origin)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue