65 lines
1.2 KiB
C#
65 lines
1.2 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using TMPro;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
/// <summary>
|
||
/// 模拟操作
|
||
/// 1,材质替换
|
||
/// 2,粒子控制
|
||
/// </summary>
|
||
public class GuoLuMoLi : MonoBehaviour
|
||
{
|
||
[Tooltip("烟雾物体")]
|
||
public MeshRenderer YanRender;
|
||
public Material[] Materials;
|
||
[Tooltip("喷火粒子")]
|
||
public ParticleSystem HuoParticle;
|
||
|
||
private Material m_yanMat;
|
||
|
||
public Image[] AllImgs;
|
||
public Sprite[] AllSprites;
|
||
|
||
public TextMeshProUGUI TextMPU;
|
||
|
||
|
||
private void Awake()
|
||
{
|
||
m_yanMat = YanRender.material;
|
||
}
|
||
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
HuoParticle.Stop();
|
||
}
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
|
||
}
|
||
|
||
public void StartToChange()
|
||
{
|
||
YanRender.material = Materials[1];
|
||
HuoParticle.Play();
|
||
|
||
AllImgs[0].sprite = AllSprites[1];
|
||
AllImgs[1].sprite = AllSprites[2];
|
||
TextMPU.text = "开";
|
||
}
|
||
|
||
public void EndToChange()
|
||
{
|
||
YanRender.material = Materials[0];
|
||
HuoParticle.Stop();
|
||
|
||
AllImgs[0].sprite = AllSprites[0];
|
||
AllImgs[1].sprite = AllSprites[3];
|
||
TextMPU.text = "关";
|
||
}
|
||
}
|