您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
896 B
25 行
896 B
using UnityEngine;
|
|
|
|
namespace Unity.UIWidgets.Sample.Redux.ObjectFinder {
|
|
public class FinderGameObject : MonoBehaviour {
|
|
// Start is called before the first frame update
|
|
void Start() {
|
|
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 0, 0, 1.0f);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update() {
|
|
var selectedId = StoreProvider.store.state.selected;
|
|
if (selectedId == this.GetInstanceID()) {
|
|
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 0, 0, 1.0f);
|
|
}
|
|
else {
|
|
this.GetComponent<MeshRenderer>().material.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
|
|
}
|
|
}
|
|
|
|
void OnMouseDown() {
|
|
StoreProvider.store.Dispatch(new SelectObjectAction() {id = this.GetInstanceID()});
|
|
}
|
|
}
|
|
}
|