82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class Fraction : MonoBehaviour
|
|
{
|
|
public new int id;
|
|
[Header("是否完成")]
|
|
public bool CompletedorNot;
|
|
[Header("是否是错误项")]
|
|
public bool Erroritem;
|
|
[Header("当前项分数")]
|
|
public int scorercontinuer;
|
|
//[Header("当前项名字")]
|
|
//public string scorercontinuerName;
|
|
[Header("碰撞的名字")]
|
|
public string name;
|
|
[Header("名字")]
|
|
public string orderName;
|
|
public bool Enable = false;
|
|
public string stepName;
|
|
public bool isOnce = true;
|
|
private void Start()
|
|
{
|
|
//FractionManager.Instance?.fractions.Add(this);
|
|
Enable = true;
|
|
}
|
|
//public void OnCollisionEnter(Collision collision)
|
|
//{
|
|
// if (Enable)
|
|
// {
|
|
// Debug.Log(collision.collider.name);
|
|
// if (collision.collider.name.Equals(name))
|
|
// {
|
|
// CompletedorNot = true;
|
|
// if (CompletedorNot)
|
|
// {
|
|
// FractionManager.ins.overAsync(id, scorercontinuer, orderName);
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
private void OnMouseDown()
|
|
{
|
|
if (!EventSystem.current.IsPointerOverGameObject())
|
|
{
|
|
if (Enable)
|
|
{
|
|
CompletedorNot = true;
|
|
if (CompletedorNot)
|
|
{
|
|
if (orderName == "验电")
|
|
{
|
|
if (isOnce)
|
|
{
|
|
FractionManager.Instance.SwitchTestPenStep(this, ref isOnce);
|
|
//if (stepName == "插座One")
|
|
//{
|
|
// gameObject.SetActive(false);
|
|
//}
|
|
if (stepName == "柜门")
|
|
{
|
|
if (FractionManager.Instance.testPen.Count != 0)
|
|
{
|
|
if (FractionManager.Instance.testPen[0].stepName.Contains("插座"))
|
|
FractionManager.Instance.testPen[0].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FractionManager.Instance.overAsync(id, scorercontinuer, orderName);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|