Files
Darklings-FightingGame/Assets/_Project/Scripts/UIScripts/PlayerCharacterSelector.cs

41 lines
1.0 KiB
C#
Raw Permalink Normal View History

2021-09-14 00:49:55 +02:00
using System.Collections;
2021-09-13 08:26:10 +02:00
using UnityEngine;
public class PlayerCharacterSelector : MonoBehaviour
{
2022-10-07 17:31:42 +03:00
private RectTransform _rectTransform;
private Vector2 _directionInput;
private Audio _audio;
2021-09-20 00:14:32 +02:00
2021-09-13 08:26:10 +02:00
2022-10-07 17:31:42 +03:00
public bool HasSelected { get; set; }
2021-09-13 08:26:10 +02:00
2021-09-19 20:50:43 +02:00
2022-10-07 17:31:42 +03:00
void Awake()
{
_audio = GetComponent<Audio>();
}
2021-09-13 08:26:10 +02:00
2022-10-07 17:31:42 +03:00
private void OnEnable()
{
_rectTransform = GetComponent<RectTransform>();
}
2022-07-13 01:29:02 +03:00
2022-10-07 17:31:42 +03:00
IEnumerator ResetInput()
{
_directionInput = Vector2.zero;
yield return new WaitForSeconds(0.15f);
}
2021-09-14 00:49:55 +02:00
2022-10-07 17:31:42 +03:00
private void OnTriggerEnter2D(Collider2D collision)
{
Vector2 currentPosition = new Vector2(transform.localPosition.x, transform.localPosition.y + 180.0f);
if (Mathf.Approximately(currentPosition.x, collision.transform.localPosition.x))
{
_audio.Sound("Selected").Play();
PlayerStatsSO playerStats = collision.GetComponent<CharacterButton>().PlayerStatsSO;
bool isRandomizer = collision.GetComponent<CharacterButton>().IsRandomizer;
}
}
2021-09-13 08:26:10 +02:00
}