WXGame/d2/Assets/Script/ObjectEndity/PassengerObject.cs

47 lines
984 B
C#
Raw Permalink Normal View History

2024-10-22 11:31:23 +08:00
using System;
2024-10-22 09:17:28 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2024-10-22 11:31:23 +08:00
using UnityEngine.UI;
2024-10-22 09:17:28 +08:00
2024-10-22 11:31:23 +08:00
//人物脚本
2024-10-22 09:17:28 +08:00
public class PassengerObject : MonoBehaviour
{
2024-10-22 11:31:23 +08:00
public ColorEnum passColor
{
get { return objColor; }
set
{
objColor = value;
if (_image==null)
{
_image = GetComponent<Image>();
}
2024-10-23 09:12:15 +08:00
_image.color = objColor switch
2024-10-22 11:31:23 +08:00
{
2024-10-23 09:12:15 +08:00
ColorEnum.white => Color.white,
ColorEnum.red => Color.red,
ColorEnum.yellow => Color.yellow,
_ => throw new ArgumentOutOfRangeException()
};
2024-10-22 11:31:23 +08:00
}
}
[SerializeField]
private ColorEnum objColor=ColorEnum.white;
[SerializeField] private Image _image;
2024-10-22 09:17:28 +08:00
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}