@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:0c95bbb6ed08b700412d51e115fe5989b61124432da37f0bf4b4d51dc54cd8f2 | |||
size 415 | |||
oid sha256:362b0120802255e93f8c0b15edc15dd357571757d07e6a9f75a9666050a1469a | |||
size 962 |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: e082f07e6a38ded42945888080672510 | |||
folderAsset: yes | |||
DefaultImporter: | |||
externalObjects: {} | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:815e838d40fc858ba3fca1d9f6ac75c76fdd5b6e1859a7145c142a7f636d3a5f | |||
size 616 | |||
oid sha256:34e0722afbe625d87d5ef748ee29a3ed763df335fd3bb1f189820962121e4411 | |||
size 675 |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:4b1a4c27ea4794695f72f8d3f5d345c28103a2b6cc53e67b8f24f0757617b5e7 | |||
size 449 | |||
oid sha256:49d74fee28f711c623d0d219f70aa6b3099be45bbb398fc9b46373c2f962a3c5 | |||
size 507 |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:6cd2eb3de9510a6319b174a92b11d1966b6f1bf6258b95c60b88af35c2666499 | |||
size 437 | |||
oid sha256:32f839ca370d74c812af63fa2b54ea03337bbc29aa02e1c325a37869ea9e2f0f | |||
size 511 |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: 48f0ea7af28c10846b5b76ce70d06b60 | |||
NativeFormatImporter: | |||
externalObjects: {} | |||
mainObjectFileID: 11400000 | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:8f30f384f120eeb69292d9ff04a9e267e536ef80a35c6a7820a032e88257d9e8 | |||
size 434 | |||
oid sha256:2c02ccd234c974be76b21bbc246437fb9b8bb724e596d77213d0023012cf1996 | |||
size 508 |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: 0b1bcd75cb7dade4fb598ee3412594c2 | |||
NativeFormatImporter: | |||
externalObjects: {} | |||
mainObjectFileID: 11400000 | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:323f3c70cf40755730cb81a31da6a58931177674b836d0b5bbc8b9f88af4b447 | |||
size 456 | |||
oid sha256:b8a99ebd1cdcc067be9e66d49377b3fea82bccb6ed878edf467bd9af4020451b | |||
size 514 |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: aa238796cf1886244951ec8c2fed1855 | |||
NativeFormatImporter: | |||
externalObjects: {} | |||
mainObjectFileID: 11400000 | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -1,3 +1,3 @@ | |||
version https://git-lfs.github.com/spec/v1 | |||
oid sha256:a6886b6e048617b3ecd1de69b35f0e598467d7d2444a59a26f58fcb16a988960 | |||
size 457 | |||
oid sha256:03cc745c401648ff6ebd18a61cb036d5b11da4725fe81d5d8203de7d48e44684 | |||
size 516 |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: 41f4cb946475b2849a802a8297d81e25 | |||
NativeFormatImporter: | |||
externalObjects: {} | |||
mainObjectFileID: 11400000 | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||
fileFormatVersion: 2 | |||
guid: 9f894080ae602c6439d69dad1ff79bdd | |||
NativeFormatImporter: | |||
externalObjects: {} | |||
mainObjectFileID: 0 | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -0,0 +1,7 @@ | |||
fileFormatVersion: 2 | |||
guid: 3fbc9b76d5c4f7348b60a029bc2ba63f | |||
PrefabImporter: | |||
externalObjects: {} | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |
@ -0,0 +1,85 @@ | |||
using System.Collections; | |||
using System.Collections.Generic; | |||
using UnityEngine; | |||
public class PlayerUIManager : MonoBehaviour | |||
{ | |||
[SerializeField] | |||
private RectTransform Inventory; | |||
[SerializeField] | |||
private float AnimationSpeed = 0.5f; | |||
[SerializeField] | |||
private BlockInput characterInput; | |||
[SerializeField] | |||
private LogicTrayUI TrayUI; | |||
private Vector3 ShowPosition; | |||
private Vector3 HidePosition; | |||
private void Awake() | |||
{ | |||
ShowPosition = new Vector3(0, -Inventory.rect.height / 2, 0); | |||
HidePosition = new Vector3(0, Inventory.rect.height/2, 0); | |||
Debug.Log(Inventory.rect.height); | |||
Inventory.anchoredPosition = HidePosition; | |||
TrayUI.SetBlockReader(characterInput.blockReader); | |||
} | |||
[ContextMenu("Show")] | |||
public void OnClick_Show() | |||
{ | |||
StopAllCoroutines(); | |||
StartCoroutine( LerpPosition(Inventory, ShowPosition, AnimationSpeed)); | |||
} | |||
[ContextMenu("Hide")] | |||
public void OnClick_Hide() | |||
{ | |||
StopAllCoroutines(); | |||
StartCoroutine( LerpPosition(Inventory, HidePosition, AnimationSpeed)); | |||
} | |||
public void OnClick_Toggle() | |||
{ | |||
if (Vector3.Distance(Inventory.anchoredPosition,ShowPosition) < Vector3.Distance(Inventory.anchoredPosition, HidePosition)) | |||
{ | |||
Debug.Log("Hiding Menu"); | |||
OnClick_Hide(); | |||
} | |||
else | |||
{ | |||
Debug.Log("Showing Menu"); | |||
OnClick_Show(); | |||
} | |||
} | |||
public void OnClick_Play() { | |||
OnClick_Hide(); | |||
characterInput.ReadAll(); | |||
} | |||
private IEnumerator LerpPosition(RectTransform rt, Vector3 endPosition, float time) | |||
{ | |||
float elapsedTime = 0; | |||
Vector3 startPos = rt.anchoredPosition; | |||
while (elapsedTime < time) | |||
{ | |||
rt.anchoredPosition = Vector3.Slerp(startPos, endPosition, (elapsedTime / time)); | |||
elapsedTime += Time.deltaTime; | |||
yield return new WaitForEndOfFrame(); | |||
} | |||
rt.anchoredPosition = endPosition; | |||
} | |||
} |
@ -0,0 +1,11 @@ | |||
fileFormatVersion: 2 | |||
guid: 0d56bc0314445a44cb43d566c4a87510 | |||
MonoImporter: | |||
externalObjects: {} | |||
serializedVersion: 2 | |||
defaultReferences: [] | |||
executionOrder: 0 | |||
icon: {instanceID: 0} | |||
userData: | |||
assetBundleName: | |||
assetBundleVariant: |