You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
66 lines
1.6 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class YingPan : MonoBehaviour
|
|
{
|
|
public Button left;
|
|
public Button right;
|
|
public Button sure;
|
|
public Transform yp;
|
|
public MeshRenderer render;
|
|
private MaterialPropertyBlock mpb;
|
|
private Color color = Color.red;
|
|
private int rotate = 1;
|
|
private void Awake()
|
|
{
|
|
mpb = new MaterialPropertyBlock();
|
|
left.onClick.AddListener(() =>
|
|
{
|
|
rotate -= 1;
|
|
yp.DOLocalRotate(yp.localEulerAngles + Vector3.forward * 45, 0.1f);
|
|
if (rotate == 0 || rotate % 8==0)
|
|
{
|
|
color = Color.yellow;
|
|
}
|
|
else
|
|
{
|
|
color = Color.red;
|
|
}
|
|
});
|
|
|
|
right.onClick.AddListener(() =>
|
|
{
|
|
rotate += 1;
|
|
yp.DOLocalRotate(yp.localEulerAngles - Vector3.forward * 45, 0.1f);
|
|
if (rotate == 0 || rotate % 8==0)
|
|
{
|
|
color = Color.yellow;
|
|
}
|
|
else
|
|
{
|
|
color = Color.red;
|
|
}
|
|
});
|
|
|
|
sure.onClick.AddListener(() =>
|
|
{
|
|
if (rotate == 0 || rotate % 8==0)
|
|
{
|
|
render.gameObject.SetActive(false);
|
|
TimeLineManager.Instance.yp.Play();
|
|
gameObject.SetActive(false);
|
|
}
|
|
});
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
mpb.SetColor("_LineColor",color);
|
|
mpb.SetFloat("_LineWidth",0.03f);
|
|
render.SetPropertyBlock(mpb);
|
|
}
|
|
} |