您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
48 行
956 B
48 行
956 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class NumberDisplayBehaviour : MonoBehaviour
|
|
{
|
|
|
|
[Header("Animation")]
|
|
public Animation numberAnimation;
|
|
|
|
[Header("Display")]
|
|
public TextMeshPro textDisplay;
|
|
|
|
public void SetupDisplay(int newNumber, Vector3 newPosition, Color newColor)
|
|
{
|
|
UpdateNumber(newNumber);
|
|
UpdateColor(newColor);
|
|
UpdatePosition(newPosition);
|
|
PlaySequence();
|
|
}
|
|
|
|
void UpdateNumber(int numberValue)
|
|
{
|
|
textDisplay.SetText(numberValue.ToString());
|
|
}
|
|
|
|
void UpdateColor(Color color)
|
|
{
|
|
textDisplay.color = color;
|
|
}
|
|
|
|
void UpdatePosition(Vector3 position)
|
|
{
|
|
transform.SetPositionAndRotation(position, transform.rotation);
|
|
}
|
|
|
|
void PlaySequence()
|
|
{
|
|
numberAnimation.Play();
|
|
}
|
|
|
|
void RemoveNumber()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
}
|