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(); } switch (objColor) { case ColorEnum.white: _image.color = Color.white; break; case ColorEnum.red: _image.color = Color.red; break; case ColorEnum.yellow: _image.color = Color.yellow; break; default: 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() { } }