Merge branch 'develop' into 6.14优化
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using DG.Tweening;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -18,7 +13,10 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private const string SocketObjName = "Socket";
|
||||
|
||||
public Transform socketPos;
|
||||
private Transform _socketPos;
|
||||
private Transform _socketLeft;
|
||||
private Transform _socketRight;
|
||||
private Tween _socketTween;
|
||||
|
||||
private BodyModuleSystem _bodyModuleSystem;
|
||||
private Material _highlightMaterial;
|
||||
@@ -44,6 +42,7 @@ namespace AibisDream.FixSystem
|
||||
[SerializeField] public BodyModuleData data;
|
||||
public bool available = true;
|
||||
private bool _cutting;
|
||||
private bool _isOpen;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -53,7 +52,10 @@ namespace AibisDream.FixSystem
|
||||
|
||||
private void InitReference()
|
||||
{
|
||||
socketPos = transform.Find(SocketObjName);
|
||||
_socketPos = transform.Find(SocketObjName);
|
||||
_socketLeft = _socketPos.Find("Left");
|
||||
_socketRight = _socketPos.Find("Right");
|
||||
|
||||
_bodyModuleSystem = transform.parent.parent.GetComponent<BodyModuleSystem>();
|
||||
|
||||
_targetSpriteRenderer = transform.Find("Module Pic").GetComponent<SpriteRenderer>();
|
||||
@@ -71,14 +73,6 @@ namespace AibisDream.FixSystem
|
||||
_alarmMaterial = Resources.Load<Material>("Materials/AlarmMaterial");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_cutting && Input.GetMouseButton(0))
|
||||
{
|
||||
//OnCut();
|
||||
}
|
||||
}
|
||||
|
||||
#region 插槽功能
|
||||
|
||||
public bool IsAvailable()
|
||||
@@ -104,7 +98,35 @@ namespace AibisDream.FixSystem
|
||||
|
||||
public Vector3 GetSocketPos()
|
||||
{
|
||||
return socketPos.position;
|
||||
return _socketPos.position;
|
||||
}
|
||||
|
||||
public void OpenPlugSlot()
|
||||
{
|
||||
if (!_socketLeft) return;
|
||||
|
||||
if (_isOpen) return;
|
||||
_isOpen = true;
|
||||
// 打开插槽
|
||||
if (_socketTween is { active: true } && _socketTween.IsPlaying()) _socketTween.Kill(true);
|
||||
var sequence = DOTween.Sequence();
|
||||
sequence.Join(_socketLeft.DOScale(new Vector3(0, 1, 1), 0.1f).SetEase(Ease.InSine));
|
||||
sequence.Join(_socketRight.DOScale(new Vector3(0, 1, 1), 0.1f).SetEase(Ease.InSine));
|
||||
_socketTween = sequence;
|
||||
}
|
||||
|
||||
public void ClosePlugSlot()
|
||||
{
|
||||
if (!_socketLeft) return;
|
||||
if (!_isOpen) return;
|
||||
|
||||
_isOpen = false;
|
||||
// 关闭插槽
|
||||
if (_socketTween != null && _socketTween.IsPlaying()) _socketTween.Kill(true);
|
||||
var sequence = DOTween.Sequence();
|
||||
sequence.Join(_socketLeft.DOScale(new Vector3(1, 1, 1), 0.1f).SetEase(Ease.OutSine));
|
||||
sequence.Join(_socketRight.DOScale(new Vector3(1, 1, 1), 0.1f).SetEase(Ease.OutSine));
|
||||
_socketTween = sequence;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user