Files
the-island/unity-client/Assets/TextMesh Pro/Examples & Extras/Scripts/TMPro_InstructionOverlay.cs
empty 64ed46215f feat: add Unity 6 client with 2.5D visual system
Unity client features:
- WebSocket connection via NativeWebSocket
- 2.5D agent visuals with programmatic placeholder sprites
- Billboard system for sprites and UI elements
- Floating UI panels (name, HP, energy bars)
- Speech bubble system with pop-in animation
- RTS-style camera controller (WASD + scroll zoom)
- Editor tools for prefab creation and scene setup

Scripts:
- NetworkManager: WebSocket singleton
- GameManager: Agent spawning and event handling
- AgentVisual: 2.5D sprite and UI creation
- Billboard: Camera-facing behavior
- SpeechBubble: Animated dialogue display
- CameraController: RTS camera with UI input detection
- UIManager: HUD and command input

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 12:17:04 +08:00

85 lines
3.3 KiB
C#
Executable File

using UnityEngine;
using System.Collections;
namespace TMPro.Examples
{
public class TMPro_InstructionOverlay : MonoBehaviour
{
public enum FpsCounterAnchorPositions { TopLeft, BottomLeft, TopRight, BottomRight };
public FpsCounterAnchorPositions AnchorPosition = FpsCounterAnchorPositions.BottomLeft;
private const string instructions = "Camera Control - <#ffff00>Shift + RMB\n</color>Zoom - <#ffff00>Mouse wheel.";
private TextMeshPro m_TextMeshPro;
private TextContainer m_textContainer;
private Transform m_frameCounter_transform;
private Camera m_camera;
//private FpsCounterAnchorPositions last_AnchorPosition;
void Awake()
{
if (!enabled)
return;
m_camera = Camera.main;
GameObject frameCounter = new GameObject("Frame Counter");
m_frameCounter_transform = frameCounter.transform;
m_frameCounter_transform.parent = m_camera.transform;
m_frameCounter_transform.localRotation = Quaternion.identity;
m_TextMeshPro = frameCounter.AddComponent<TextMeshPro>();
m_TextMeshPro.font = Resources.Load<TMP_FontAsset>("Fonts & Materials/LiberationSans SDF");
m_TextMeshPro.fontSharedMaterial = Resources.Load<Material>("Fonts & Materials/LiberationSans SDF - Overlay");
m_TextMeshPro.fontSize = 30;
m_TextMeshPro.isOverlay = true;
m_textContainer = frameCounter.GetComponent<TextContainer>();
Set_FrameCounter_Position(AnchorPosition);
//last_AnchorPosition = AnchorPosition;
m_TextMeshPro.text = instructions;
}
void Set_FrameCounter_Position(FpsCounterAnchorPositions anchor_position)
{
switch (anchor_position)
{
case FpsCounterAnchorPositions.TopLeft:
//m_TextMeshPro.anchor = AnchorPositions.TopLeft;
m_textContainer.anchorPosition = TextContainerAnchors.TopLeft;
m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 1, 100.0f));
break;
case FpsCounterAnchorPositions.BottomLeft:
//m_TextMeshPro.anchor = AnchorPositions.BottomLeft;
m_textContainer.anchorPosition = TextContainerAnchors.BottomLeft;
m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(0, 0, 100.0f));
break;
case FpsCounterAnchorPositions.TopRight:
//m_TextMeshPro.anchor = AnchorPositions.TopRight;
m_textContainer.anchorPosition = TextContainerAnchors.TopRight;
m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 1, 100.0f));
break;
case FpsCounterAnchorPositions.BottomRight:
//m_TextMeshPro.anchor = AnchorPositions.BottomRight;
m_textContainer.anchorPosition = TextContainerAnchors.BottomRight;
m_frameCounter_transform.position = m_camera.ViewportToWorldPoint(new Vector3(1, 0, 100.0f));
break;
}
}
}
}