12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using DG.Tweening;
- public class ButtonArrowHandler : MonoBehaviour
- {
- public enum ButtonState
- {
- Left,
- Right
- }
- public ButtonState CurButton;
- public void OnMouseDown()
- {
- Debug.Log("OnClick");
- transform.DOScale(1.1f, 0.2f).OnComplete(() => {
- transform.DOScale(1f, 0.2f);
- });
- switch(CurButton)
- {
- case ButtonState.Left:
- if (Core.Instance.CurIndexPlayer - 1 <= 0)
- {
- Core.Instance.CurIndexPlayer = 0;
- //return;
- }
- else
- {
- Core.Instance.CurIndexPlayer--;
- }
- break;
- case ButtonState.Right:
- if (Core.Instance.CurIndexPlayer + 1 >= Core.Instance.PlayerMalePrefabs.Count)
- {
- Core.Instance.CurIndexPlayer = Core.Instance.PlayerMalePrefabs.Count - 1;
- //return;
- }
- else
- {
- Core.Instance.CurIndexPlayer++;
- }
- break;
- }
- Core.Instance.GetPlayerForSelecting(Core.Instance.CurIndexPlayer, Core.Instance.CurGender);
- }
- }
|