2023-03-08 23:34:47 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_DJSchool
|
|
|
|
{
|
|
|
|
public class DJYellow : MonoBehaviour
|
|
|
|
{
|
|
|
|
public enum DJExpression
|
|
|
|
{
|
|
|
|
NeutralLeft = 0,
|
|
|
|
NeutralRight = 1,
|
|
|
|
CrossEyed = 2,
|
|
|
|
Happy = 3,
|
|
|
|
Focused = 4,
|
|
|
|
UpFirst = 5,
|
|
|
|
UpSecond = 6,
|
|
|
|
}
|
|
|
|
[SerializeField] List<Sprite> djYellowHeadSprites = new List<Sprite>();
|
2023-06-04 04:30:42 +00:00
|
|
|
[SerializeField] SpriteRenderer djYellowHeadSprite;
|
2023-03-08 23:34:47 +00:00
|
|
|
float normalXScale;
|
|
|
|
float negativeXScale;
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
{
|
2023-06-04 04:30:42 +00:00
|
|
|
normalXScale = djYellowHeadSprite.transform.localScale.x;
|
2023-03-08 23:34:47 +00:00
|
|
|
negativeXScale = -normalXScale;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ChangeHeadSprite(DJExpression expression)
|
|
|
|
{
|
|
|
|
if (expression == DJExpression.UpFirst && HeadSpriteCheck(DJExpression.UpSecond)) return;
|
2023-06-04 04:30:42 +00:00
|
|
|
djYellowHeadSprite.sprite = djYellowHeadSprites[(int)expression];
|
2023-03-08 23:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool HeadSpriteCheck(DJExpression expression)
|
|
|
|
{
|
2023-06-04 04:30:42 +00:00
|
|
|
return djYellowHeadSprite.sprite == djYellowHeadSprites[(int)expression];
|
2023-03-08 23:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Reverse(bool should = false)
|
|
|
|
{
|
2023-06-04 04:30:42 +00:00
|
|
|
djYellowHeadSprite.transform.localScale = new Vector3(should ? negativeXScale : normalXScale, normalXScale, normalXScale);
|
2023-03-08 23:34:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|