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

53 lines
1.2 KiB
C#
Raw 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>();
}
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;
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()
{
}
}