56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ClickMoveMore : Device_Base
|
|
{
|
|
public int current;
|
|
public List<Vector3> dangWeis;
|
|
|
|
private void Update()
|
|
{
|
|
int btn = 0;
|
|
if(Input.GetMouseButtonDown(0))
|
|
btn = 1;
|
|
else if(Input.GetMouseButtonDown(1))
|
|
btn = -1;
|
|
|
|
if (btn!=0)
|
|
{
|
|
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition),out RaycastHit hitInfo))
|
|
{
|
|
if(hitInfo.transform==transform)
|
|
{
|
|
if(btn==1)
|
|
{
|
|
//Éϵ÷¼Ó
|
|
if(current< dangWeis.Count-1)
|
|
{
|
|
if (triggerAction?.Invoke("¼Ó+"+triggerName, true) == 0)
|
|
{
|
|
current += 1;
|
|
transform.localPosition = dangWeis[current];
|
|
CallScoreAction(current);
|
|
}
|
|
}
|
|
}
|
|
else if(btn==-1)
|
|
{
|
|
//ϵ÷¼õ
|
|
if(current>0)
|
|
{
|
|
if (triggerAction?.Invoke("¼õ+" + triggerName, true) == 0)
|
|
{
|
|
current -= 1;
|
|
transform.localPosition = dangWeis[current];
|
|
CallScoreAction(current);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
} |