editing scenes and UI
This commit is contained in:
@@ -21,7 +21,7 @@ public class Train : MonoBehaviour
|
||||
transform.localPosition.y,
|
||||
startPosition);
|
||||
|
||||
transform.DOLocalMoveZ(-4, speed)
|
||||
transform.DOLocalMoveZ(-16, speed)
|
||||
.SetEase(Ease.OutSine);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
public class UIAbout : UICanvas
|
||||
{
|
||||
[SerializeField] UICanvas background;
|
||||
[SerializeField] UICanvas infoButton;
|
||||
[SerializeField] UICanvas menu;
|
||||
[SerializeField] UICanvas aboutCPPK;
|
||||
[SerializeField] UICanvas aboutGRAFF;
|
||||
|
||||
public void ShowAboutCPPK()
|
||||
{
|
||||
menu.OnHide
|
||||
.AddListener(() => aboutCPPK.gameObject.SetActive(true));
|
||||
}
|
||||
|
||||
public void ShowAboutGRAFF()
|
||||
{
|
||||
menu.OnHide
|
||||
.AddListener(() => aboutGRAFF.gameObject.SetActive(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c09f4986609d7a44686b79bf3753a469
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,11 +3,14 @@ using System.Collections.Generic;
|
||||
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class UICanvas : MonoBehaviour
|
||||
{
|
||||
CanvasGroup canvasGroup;
|
||||
public UnityEvent OnHide;
|
||||
[SerializeField] float duration;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -16,19 +19,24 @@ public class UICanvas : MonoBehaviour
|
||||
|
||||
public void Show()
|
||||
{
|
||||
canvasGroup.DOFade(1, .4f);
|
||||
canvasGroup.DOFade(1, duration);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
canvasGroup.DOFade(0, .4f);
|
||||
gameObject.SetActive(false);
|
||||
canvasGroup.DOFade(0, duration)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
OnHide?.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if(canvasGroup == null)
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
|
||||
canvasGroup.alpha = 0;
|
||||
Show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user