47 lines
984 B
C#
47 lines
984 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
//人物脚本
|
|
public class PassengerObject : MonoBehaviour
|
|
{
|
|
|
|
public ColorEnum passColor
|
|
{
|
|
get { return objColor; }
|
|
set
|
|
{
|
|
objColor = value;
|
|
if (_image==null)
|
|
{
|
|
_image = GetComponent<Image>();
|
|
}
|
|
|
|
_image.color = objColor switch
|
|
{
|
|
ColorEnum.white => Color.white,
|
|
ColorEnum.red => Color.red,
|
|
ColorEnum.yellow => Color.yellow,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
}
|
|
}
|
|
[SerializeField]
|
|
private ColorEnum objColor=ColorEnum.white;
|
|
|
|
[SerializeField] private Image _image;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|