51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class WristConsole : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private TextMeshProUGUI consoleText;
|
|
|
|
[SerializeField]
|
|
private GameObject anchor;
|
|
|
|
string output = "";
|
|
|
|
private void OnEnable()
|
|
{
|
|
Application.logMessageReceived += logMessageReceived;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
Application.logMessageReceived -= logMessageReceived;
|
|
}
|
|
|
|
private void logMessageReceived(string log, string stack, LogType type)
|
|
{
|
|
output = log + "\n" + output;
|
|
consoleText.text = output;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
Vector3 fakeForward = anchor.transform.forward;
|
|
fakeForward.y = 0.0f;
|
|
fakeForward.Normalize();
|
|
|
|
transform.position = Vector3.Lerp(
|
|
transform.position,
|
|
new Vector3(
|
|
anchor.transform.position.x,
|
|
anchor.transform.position.y - 1.0f,
|
|
anchor.transform.position.z)
|
|
+ fakeForward * 1.5f,
|
|
Time.deltaTime * 20.0f);
|
|
|
|
transform.rotation = Quaternion.LookRotation(transform.position - anchor.transform.position);
|
|
}
|
|
}
|