using UnityEngine; using Photon.Pun; // ส่วนตกแต่งของ PlayerController: สียาน (ShipPaint) และอีโมตระหว่างแข่ง ไม่มีผลต่อการเล่น public partial class PlayerController { private Color paintTint = Color.white; public Color PaintTint => paintTint; // ข้อความอีโมต: index ส่งผ่าน Photon อย่าสลับลำดับ public static readonly string[] Emotes = { "GG", "NICE SHOT!", "OOPS!", "HELLO!" }; private const float EmoteCooldown = 2.5f; private float nextEmoteAt; private void ApplyPaint() { paintTint = ShipPaint.For(photonView.Owner); if (spriteRenderer != null && !isStunned && !isDead) spriteRenderer.color = paintTint; } // เรียกจากปุ่มอีโมตบน HUD (เฉพาะยานของเรา) มีคูลดาวน์กันสแปม public bool TrySendEmote(int index) { if (!photonView.IsMine || index < 0 || index >= Emotes.Length) return false; if (Time.unscaledTime < nextEmoteAt) return false; nextEmoteAt = Time.unscaledTime + EmoteCooldown; photonView.RPC("ShowEmoteRPC", RpcTarget.All, index); return true; } [PunRPC] public void ShowEmoteRPC(int index, PhotonMessageInfo info) { if (info.Sender != photonView.Owner || index < 0 || index >= Emotes.Length) return; if (GameplayManager.Instance != null) GameplayManager.Instance.ShowEmote(this, Emotes[index]); } }