Merge branch 'develop' into 6.14优化
This commit is contained in:
@@ -12,7 +12,7 @@ namespace AibisDream.FixSystem
|
||||
public class Plug : MonoBehaviour, IInteraction
|
||||
{
|
||||
private static readonly int ShineFade = Shader.PropertyToID("_ShineFade");
|
||||
|
||||
|
||||
#region 插头当前信息
|
||||
|
||||
private Vector3 _startPos;
|
||||
@@ -39,9 +39,10 @@ namespace AibisDream.FixSystem
|
||||
private void Awake()
|
||||
{
|
||||
InitComponentRef();
|
||||
EventRegister();
|
||||
EventRegister();
|
||||
_RetractedPos = transform.position;
|
||||
_startPos = new Vector3(transform.position.x+0.3f, transform.position.y - 2f, transform.position.z); // 初始化时记录初始位置
|
||||
_startPos = new Vector3(transform.position.x + 0.3f, transform.position.y - 2f,
|
||||
transform.position.z); // 初始化时记录初始位置
|
||||
}
|
||||
|
||||
private void InitComponentRef()
|
||||
@@ -50,7 +51,7 @@ namespace AibisDream.FixSystem
|
||||
_sprite = GetComponent<SpriteRenderer>();
|
||||
_plugRootPos = transform.Find("Plug Root Pos");
|
||||
_trigger = GetComponent<EventTriggerEx>();
|
||||
|
||||
|
||||
// 处理插头高亮
|
||||
_sprite.material.SetFloat(ShineFade, GlobalVariableKit.IsPlugHighLight ? 1 : 0);
|
||||
}
|
||||
@@ -62,7 +63,7 @@ namespace AibisDream.FixSystem
|
||||
_trigger.Register(EventTriggerType.PointerUp, OnPointerUp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 插入某个socket
|
||||
/// </summary>
|
||||
@@ -138,8 +139,8 @@ namespace AibisDream.FixSystem
|
||||
GetComponent<SpriteRenderer>().sortingOrder = 48;
|
||||
// 系统被锁定就返回
|
||||
if (!_cableSystem.IsPlugAvailable()) return;
|
||||
|
||||
|
||||
|
||||
|
||||
// 首次拖拽后关闭高亮
|
||||
if (GlobalVariableKit.IsPlugHighLight)
|
||||
{
|
||||
@@ -184,9 +185,10 @@ namespace AibisDream.FixSystem
|
||||
public void ReturnToStartPosition()
|
||||
{
|
||||
PlugPosBack();
|
||||
transform.DOMove(_startPos, 0.1f).OnComplete(() => {
|
||||
transform.DOMove(_startPos, 0.1f).OnComplete(() =>
|
||||
{
|
||||
_cableSystem.CableReelRef.ResetRotation();
|
||||
SwitchToPhysicCableState();
|
||||
SwitchToPhysicCableState();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -209,18 +211,21 @@ namespace AibisDream.FixSystem
|
||||
_cableSystem.PhysicCableRef.GetComponent<LineRenderer>().enabled = true;
|
||||
_isPhysicCableActive = true;
|
||||
}
|
||||
|
||||
public void SetPhysicCableActive(bool active)
|
||||
{
|
||||
_isPhysicCableActive = active;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_isPhysicCableActive && !_cableSystem.isCableRetracted)
|
||||
{
|
||||
_cableSystem.PhysicCableRef.physicLine.UpdatePlug(this.transform);
|
||||
_cableSystem.PhysicCableRef.physicLine.UpdatePlug(transform);
|
||||
}
|
||||
// 如果未锁定,就一直查询是否靠近最近的插孔
|
||||
if (!_cableSystem.IsPlugAvailable()) return;
|
||||
_cableSystem.TryFindClosestModule(transform.position, out _);
|
||||
}
|
||||
|
||||
void OnDrawGizmosSelected()
|
||||
@@ -238,10 +243,6 @@ namespace AibisDream.FixSystem
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
public void SetStartPos(Vector3 pos)
|
||||
{
|
||||
_startPos = pos;
|
||||
}
|
||||
public Vector3 GetStartPos()
|
||||
{
|
||||
return _startPos;
|
||||
|
||||
Reference in New Issue
Block a user