|
|
|
|
@@ -3,10 +3,12 @@ using System.Collections.Generic;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
using Cielonos.MainGame.Effects.Feedback;
|
|
|
|
|
using Cielonos.MainGame.FunctionalAnimation;
|
|
|
|
|
using MoreMountains.Feedbacks;
|
|
|
|
|
using MoreMountains.FeedbacksForThirdParty;
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
using SLSUtilities.Feedback;
|
|
|
|
|
using SLSUtilities.WwiseAssistance;
|
|
|
|
|
using SLSUtilities.FunctionalAnimation;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
@@ -30,11 +32,13 @@ namespace Cielonos.MainGame.Characters.Inventory
|
|
|
|
|
public ViewObjectData viewObjectData;
|
|
|
|
|
public VFXData vfxData;
|
|
|
|
|
public AttributeData passiveAttributeData;
|
|
|
|
|
public UpgradeData upgradeData;
|
|
|
|
|
public ComboData comboData;
|
|
|
|
|
public AttackData attackData;
|
|
|
|
|
public FunctionData functionData;
|
|
|
|
|
public AmmoData ammoData;
|
|
|
|
|
public BlockData blockData;
|
|
|
|
|
public OverloadData overloadData;
|
|
|
|
|
|
|
|
|
|
[TitleGroup("Audio")]
|
|
|
|
|
public AudioContainer audioContainer;
|
|
|
|
|
@@ -44,6 +48,7 @@ namespace Cielonos.MainGame.Characters.Inventory
|
|
|
|
|
public ComboSubmodule comboSm;
|
|
|
|
|
public FunctionSubmodule functionSm;
|
|
|
|
|
public AmmoSubmodule ammoSm;
|
|
|
|
|
public OverloadSubmodule overloadSm;
|
|
|
|
|
|
|
|
|
|
[TitleGroup("Subcontrollers")]
|
|
|
|
|
public FeedbackSubcontroller feedbackSc;
|
|
|
|
|
@@ -57,10 +62,12 @@ namespace Cielonos.MainGame.Characters.Inventory
|
|
|
|
|
public virtual void Initialize()
|
|
|
|
|
{
|
|
|
|
|
vfxData?.Initialize(player);
|
|
|
|
|
feedbackSc?.Initialize();
|
|
|
|
|
if(comboData != null) comboSm = new ComboSubmodule(this, comboData);
|
|
|
|
|
if(functionData != null) functionSm = new FunctionSubmodule(this, functionData);
|
|
|
|
|
if(ammoData != null) ammoSm = new AmmoSubmodule(this, ammoData);
|
|
|
|
|
if(passiveAttributeData != null) passiveAttributeSm = new AttributeSubmodule(this, passiveAttributeData);
|
|
|
|
|
if(passiveAttributeData != null) passiveAttributeSm = new AttributeSubmodule(this, passiveAttributeData, upgradeData);
|
|
|
|
|
if(overloadData != null) overloadSm = new OverloadSubmodule(this, overloadData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnObtained()
|
|
|
|
|
@@ -73,9 +80,23 @@ namespace Cielonos.MainGame.Characters.Inventory
|
|
|
|
|
passiveAttributeSm?.RefreshAllModifiedAttributes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Button("Upgrade")]
|
|
|
|
|
public virtual void Upgrade()
|
|
|
|
|
{
|
|
|
|
|
if (upgradeData == null || passiveAttributeSm == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning($"{GetType().Name}: Cannot upgrade - missing UpgradeData or AttributeSubmodule.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
passiveAttributeSm.level++;
|
|
|
|
|
passiveAttributeSm.RefreshAllModifiedAttributes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Update()
|
|
|
|
|
{
|
|
|
|
|
functionSm?.Update(player.selfTimeSm.DeltaTime);
|
|
|
|
|
overloadSm?.Update(player.selfTimeSm.DeltaTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -157,31 +178,25 @@ namespace Cielonos.MainGame.Characters.Inventory
|
|
|
|
|
|
|
|
|
|
protected virtual void Swing(string feedBackName, Vector3 swingRotation = default, Vector3 swingPosition = default)
|
|
|
|
|
{
|
|
|
|
|
Vector3 playerForward = player.transform.forward;
|
|
|
|
|
Vector3 cameraForward = player.viewSc.playerCamera.transform.forward;
|
|
|
|
|
|
|
|
|
|
Vector3 flatPlayerFwd = Vector3.ProjectOnPlane(playerForward, Vector3.up).normalized;
|
|
|
|
|
Vector3 flatCameraFwd = Vector3.ProjectOnPlane(cameraForward, Vector3.up).normalized;
|
|
|
|
|
|
|
|
|
|
Quaternion deltaRotation = Quaternion.FromToRotation(flatCameraFwd, flatPlayerFwd);
|
|
|
|
|
Vector3 tempRotVec = new Vector3(swingRotation.y, swingRotation.x, swingRotation.z);
|
|
|
|
|
Vector3 rotatedTemp = deltaRotation * tempRotVec;
|
|
|
|
|
Vector3 finalRotation = new Vector3(rotatedTemp.y, rotatedTemp.x, rotatedTemp.z);
|
|
|
|
|
Vector3 finalPosition = deltaRotation * swingPosition;
|
|
|
|
|
|
|
|
|
|
MMF_CinemachineRotation cinemachineRotation = feedbackSc[feedBackName].feedback.GetFeedbackOfType<MMF_CinemachineRotation>();
|
|
|
|
|
if (cinemachineRotation != null)
|
|
|
|
|
feedbackSc.feedbackDataCollection.TryGet(feedBackName, out FeedbackData feedBackData);
|
|
|
|
|
var cameraTrack = feedBackData.tracks.Find(track => track.trackName == "Camera");
|
|
|
|
|
if (cameraTrack == null)
|
|
|
|
|
{
|
|
|
|
|
cinemachineRotation.RotationAmplitude = finalRotation;
|
|
|
|
|
Debug.LogWarning($"没有找到名为 'Camera' 的轨道,请检查 FeedbackData '{feedBackName}' 的设置。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MMF_CinemachinePosition cinemachinePosition = feedbackSc[feedBackName].feedback.GetFeedbackOfType<MMF_CinemachinePosition>();
|
|
|
|
|
if (cinemachinePosition != null)
|
|
|
|
|
if (cameraTrack.clips.Find(clip => clip.action is CameraPositionShakeAction)?.action is CameraPositionShakeAction positionShakeAction)
|
|
|
|
|
{
|
|
|
|
|
cinemachinePosition.PositionAmplitude = finalPosition;
|
|
|
|
|
positionShakeAction.amplitude = swingPosition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cameraTrack.clips.Find(clip => clip.action is CameraRotationShakeAction)?.action is CameraRotationShakeAction rotationShakeAction)
|
|
|
|
|
{
|
|
|
|
|
rotationShakeAction.amplitude = swingRotation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feedbackSc[feedBackName].Play();
|
|
|
|
|
feedbackSc.PlayFeedback(feedBackName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|