提交万用表逻辑
This commit is contained in:
parent
f34d66c0c4
commit
eb7bebd470
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Multimeter : MonoBehaviour
|
||||||
|
{
|
||||||
|
public bool electricity = false;
|
||||||
|
public bool activation = false;
|
||||||
|
private void OnMouseDown()
|
||||||
|
{
|
||||||
|
//Debug.Log("ok");
|
||||||
|
if (GameManager.ins.BlackWanYon!=null)
|
||||||
|
{
|
||||||
|
GameManager.ins.BlackWanYon.transform.parent = transform;
|
||||||
|
GameManager.ins.BlackWanYon.transform.DOLocalRotate(new Vector3(56, 0, 0), 0.25f);
|
||||||
|
GameManager.ins.BlackWanYon.transform.DOScale(new Vector3(200,200,200), 0.25f);
|
||||||
|
GameManager.ins.BlackWanYon.transform.DOLocalMove(new Vector3(0,0,-2), 0.25f);
|
||||||
|
}
|
||||||
|
if (GameManager.ins.RedWanYon != null)
|
||||||
|
{
|
||||||
|
GameManager.ins.RedWanYon.transform.parent = transform;
|
||||||
|
GameManager.ins.RedWanYon.transform.DOLocalRotate(new Vector3(56, 0, 0), 0.25f);
|
||||||
|
GameManager.ins.RedWanYon.transform.DOScale(new Vector3(200,200,200), 0.25f);
|
||||||
|
GameManager.ins.RedWanYon.transform.DOLocalMove(new Vector3(0,0, -2f), 0.25f);
|
||||||
|
}
|
||||||
|
Debug.Log("³É¹¦");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a43fdde5b2278bc4ea8228a3eae8c8ec
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
|
public class MultimeterManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] Transform blackXian;
|
||||||
|
[SerializeField] Transform RedXian;
|
||||||
|
private Multimeter multimeter;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
// 鼠标左键按下
|
||||||
|
if (Input.GetMouseButtonDown(0))
|
||||||
|
{
|
||||||
|
// 从相机位置发射一条射线经过屏幕上的鼠标点击位置
|
||||||
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||||
|
|
||||||
|
// 声明一个射线碰撞信息类
|
||||||
|
RaycastHit hit;
|
||||||
|
|
||||||
|
// 进行碰撞检测
|
||||||
|
bool res = Physics.Raycast(ray, out hit,1 << 7) && !EventSystem.current.IsPointerOverGameObject();
|
||||||
|
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
Debug.Log("装");
|
||||||
|
// 如果产生了碰撞
|
||||||
|
if (hit.collider.name.Equals("RedWanYon"))
|
||||||
|
{
|
||||||
|
Debug.Log("装2");
|
||||||
|
GameManager.ins.BlackWanYon = null;
|
||||||
|
GameManager.ins.RedWanYon = RedXian.gameObject;
|
||||||
|
}
|
||||||
|
if (hit.collider.name.Equals("BlackWanYon"))
|
||||||
|
{
|
||||||
|
GameManager.ins.RedWanYon = null;
|
||||||
|
GameManager.ins.BlackWanYon = blackXian.gameObject;
|
||||||
|
}
|
||||||
|
Debug.Log(hit.collider.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f71134dce17234846ae4a8705e1dc374
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,31 @@
|
||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class MultimeterRecovery : MonoBehaviour
|
||||||
|
{
|
||||||
|
Button btn;
|
||||||
|
[SerializeField] Transform RedTrans;
|
||||||
|
[SerializeField] Transform BlackTrans;
|
||||||
|
[SerializeField] Transform trans;
|
||||||
|
[SerializeField] Vector3 Redpos;
|
||||||
|
[SerializeField] Vector3 Blackpos;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
btn = GetComponent<Button>();
|
||||||
|
btn.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
RedTrans.parent = trans;
|
||||||
|
BlackTrans.parent = trans;
|
||||||
|
BlackTrans.transform.DOLocalRotate(new Vector3(0, 0, 0), 0.25f);
|
||||||
|
BlackTrans.transform.DOScale(new Vector3(1,1,1), 0.25f);
|
||||||
|
BlackTrans.transform.DOLocalMove(Blackpos, 0.25f);
|
||||||
|
RedTrans.transform.DOLocalRotate(new Vector3(0, 0, 0), 0.25f);
|
||||||
|
RedTrans.transform.DOScale(new Vector3(1,1,1), 0.25f);
|
||||||
|
RedTrans.transform.DOLocalMove(Redpos, 0.25f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c5742db2d9f927b41a29f6646e76863b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -27,6 +27,8 @@ public class GameManager : MonoBehaviour
|
||||||
[SerializeField] StopValve QianStopValve;
|
[SerializeField] StopValve QianStopValve;
|
||||||
public GameObject temp;
|
public GameObject temp;
|
||||||
[SerializeField] List<GameObject> interactive;
|
[SerializeField] List<GameObject> interactive;
|
||||||
|
public GameObject RedWanYon;
|
||||||
|
public GameObject BlackWanYon;
|
||||||
public Interactive interactiveEnum = Interactive.none;
|
public Interactive interactiveEnum = Interactive.none;
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,8 @@ TagManager:
|
||||||
- door
|
- door
|
||||||
- dianliu
|
- dianliu
|
||||||
- YanDian
|
- YanDian
|
||||||
|
- WanYon
|
||||||
|
- RedWanYon
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
@ -15,7 +17,7 @@ TagManager:
|
||||||
- Water
|
- Water
|
||||||
- UI
|
- UI
|
||||||
- QianXing
|
- QianXing
|
||||||
-
|
- Player
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
|
Loading…
Reference in New Issue