切换主武器
This commit is contained in:
@@ -15,14 +15,14 @@ namespace Cielonos.MainGame.Inventory
|
||||
public Player player => MainGameManager.Instance.player;
|
||||
protected PlayerAnimationSubcontroller animationSc => player.animationSc;
|
||||
protected FunctionalAnimationSubmodule fullBodyFuncAnimSm => animationSc.fullBodyFuncAnimSm;
|
||||
|
||||
public ItemViewObject viewObject;
|
||||
|
||||
[Title("Data")]
|
||||
public List<FuncAnimData> fullBodyFuncAnims = new List<FuncAnimData>();
|
||||
[HideInInspector]
|
||||
private List<string> registeredFunctionNames = new List<string>();
|
||||
|
||||
[FormerlySerializedAs("objectData")]
|
||||
public ViewObjectData viewObjectData;
|
||||
public VFXData vfxData;
|
||||
public ComboData comboData;
|
||||
public AttackData attackData;
|
||||
@@ -41,10 +41,12 @@ namespace Cielonos.MainGame.Inventory
|
||||
[Title("Subcontrollers")]
|
||||
public FeedbackSubcontroller feedbackSc;
|
||||
|
||||
|
||||
[Title("View Objects")]
|
||||
public Dictionary<string, ItemViewObject> viewObjects = new Dictionary<string, ItemViewObject>();
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
functionSm.Update(player.selfTimeSm.DeltaTime);
|
||||
functionSm?.Update(player.selfTimeSm.DeltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Cielonos.MainGame.Inventory
|
||||
{
|
||||
public partial class ItemViewObject : SerializedMonoBehaviour
|
||||
{
|
||||
public GameObject item;
|
||||
public Dictionary<string, GameObject> functionalParts;
|
||||
|
||||
public GameObject Part(string partName)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame.Characters;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
@@ -7,7 +8,6 @@ namespace Cielonos.MainGame.Inventory
|
||||
{
|
||||
public abstract partial class MainWeaponBase : ItemBase
|
||||
{
|
||||
|
||||
public BaseAnimationGroup baseAnimationGroup;
|
||||
}
|
||||
|
||||
@@ -16,17 +16,45 @@ namespace Cielonos.MainGame.Inventory
|
||||
public virtual void OnEquipped()
|
||||
{
|
||||
baseAnimationGroup.SetUp(animationSc);
|
||||
foreach (ViewObjectData.ViewObjectDataUnit unit in viewObjectData.viewObjectUnits)
|
||||
{
|
||||
Transform attachPoint = !unit.isCustomAttachPoint ?
|
||||
player.bodyPartsSc.GetPart(unit.normalAttachBodyPart) :
|
||||
player.bodyPartsSc.GetPart(unit.customAttachPartName);
|
||||
if (attachPoint != null)
|
||||
{
|
||||
ItemViewObject view = Instantiate(unit.objectPrefab, attachPoint).GetComponent<ItemViewObject>();
|
||||
if (unit.applyOffset)
|
||||
{
|
||||
view.transform.localPosition = unit.positionOffset;
|
||||
view.transform.localEulerAngles = unit.rotationOffset;
|
||||
}
|
||||
viewObjects[unit.objectName] = view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnUnequipped()
|
||||
{
|
||||
RemoveAllRegisteredFunctions();
|
||||
|
||||
foreach (ItemViewObject view in viewObjects.Values)
|
||||
{
|
||||
Destroy(view.gameObject);
|
||||
}
|
||||
viewObjects.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MainWeaponBase
|
||||
{
|
||||
protected Transform muzzle => viewObject.functionalParts["Muzzle"].transform;
|
||||
protected override void Update()
|
||||
{
|
||||
if (player.inventorySc.equipmentSm.currentMainWeapon == this)
|
||||
{
|
||||
functionSm?.Update(player.selfTimeSm.DeltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MainWeaponBase
|
||||
|
||||
Reference in New Issue
Block a user