切换主武器
This commit is contained in:
@@ -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