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>
This commit is contained in:
51
unity-client/Assets/TextMesh Pro/Examples & Extras/Scripts/ChatController.cs
Executable file
51
unity-client/Assets/TextMesh Pro/Examples & Extras/Scripts/ChatController.cs
Executable file
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class ChatController : MonoBehaviour {
|
||||
|
||||
|
||||
public TMP_InputField ChatInputField;
|
||||
|
||||
public TMP_Text ChatDisplayOutput;
|
||||
|
||||
public Scrollbar ChatScrollbar;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
ChatInputField.onSubmit.AddListener(AddToChatOutput);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
ChatInputField.onSubmit.RemoveListener(AddToChatOutput);
|
||||
}
|
||||
|
||||
|
||||
void AddToChatOutput(string newText)
|
||||
{
|
||||
// Clear Input Field
|
||||
ChatInputField.text = string.Empty;
|
||||
|
||||
var timeNow = System.DateTime.Now;
|
||||
|
||||
string formattedInput = "[<#FFFF80>" + timeNow.Hour.ToString("d2") + ":" + timeNow.Minute.ToString("d2") + ":" + timeNow.Second.ToString("d2") + "</color>] " + newText;
|
||||
|
||||
if (ChatDisplayOutput != null)
|
||||
{
|
||||
// No special formatting for first entry
|
||||
// Add line feed before each subsequent entries
|
||||
if (ChatDisplayOutput.text == string.Empty)
|
||||
ChatDisplayOutput.text = formattedInput;
|
||||
else
|
||||
ChatDisplayOutput.text += "\n" + formattedInput;
|
||||
}
|
||||
|
||||
// Keep Chat input field active
|
||||
ChatInputField.ActivateInputField();
|
||||
|
||||
// Set the scrollbar to the bottom when next text is submitted.
|
||||
ChatScrollbar.value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user