2023-07-04 21:32:21 +03:00
|
|
|
using UnityEngine;
|
2022-09-05 23:28:30 +03:00
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
public class PlayerUIRender : DemonicsAnimator
|
2022-09-05 23:28:30 +03:00
|
|
|
{
|
2022-10-12 23:30:09 +02:00
|
|
|
private Image _image;
|
2022-09-05 23:28:30 +03:00
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
public PlayerStatsSO PlayerStats { get; set; }
|
2022-09-05 23:28:30 +03:00
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
void Awake()
|
|
|
|
|
{
|
|
|
|
|
_image = GetComponent<Image>();
|
|
|
|
|
}
|
2022-09-05 23:28:30 +03:00
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
protected override void FixedUpdate()
|
|
|
|
|
{
|
2022-12-20 18:23:28 +02:00
|
|
|
PlayAnimation();
|
2022-10-12 23:30:09 +02:00
|
|
|
_image.sprite = _spriteRenderer.sprite;
|
|
|
|
|
}
|
2022-09-06 00:27:34 +03:00
|
|
|
|
2023-01-17 00:02:29 +02:00
|
|
|
public void SetPlayerStat(PlayerStatsSO playerStats)
|
|
|
|
|
{
|
|
|
|
|
_cel = 0;
|
|
|
|
|
PlayerStats = playerStats;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
public void Taunt()
|
|
|
|
|
{
|
|
|
|
|
SetAnimation("Taunt");
|
|
|
|
|
}
|
2022-09-06 00:27:34 +03:00
|
|
|
|
2022-10-12 23:30:09 +02:00
|
|
|
public int SetSpriteLibraryAsset(int skinNumber)
|
|
|
|
|
{
|
2022-10-19 13:26:10 +03:00
|
|
|
if (skinNumber > _animation.spriteAtlas.Length - 1)
|
2022-10-12 23:30:09 +02:00
|
|
|
{
|
|
|
|
|
skinNumber = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (skinNumber < 0)
|
|
|
|
|
{
|
2022-10-19 13:26:10 +03:00
|
|
|
skinNumber = _animation.spriteAtlas.Length - 1;
|
2022-10-12 23:30:09 +02:00
|
|
|
}
|
2022-10-14 23:03:29 +02:00
|
|
|
_skin = skinNumber;
|
2022-10-12 23:30:09 +02:00
|
|
|
return skinNumber;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-19 17:10:21 +03:00
|
|
|
// void OnDisable()
|
|
|
|
|
// {
|
|
|
|
|
// gameObject.SetActive(false);
|
|
|
|
|
// }
|
2022-09-05 23:28:30 +03:00
|
|
|
}
|