属性控制

This commit is contained in:
2025-09-14 16:26:41 +08:00
parent 57d360f922
commit 3c022ff4b6
43 changed files with 343 additions and 340 deletions

View File

@@ -0,0 +1,363 @@
using System;
using RootMotion.FinalIK;
using UnityEngine;
namespace NBF
{
public enum ThrowModeEnum : int
{
Spin = 0,
Float = 1,
}
public enum HandItemType
{
Default = 0,
HandRod = 1,
SpinRod = 2,
}
public class PlayerAsset : MonoBehaviour
{
public Transform FPSCamera;
public GameObject FishingLight;
public Animator Animator { get; private set; }
public LookAtIK LookAtIK { get; private set; }
public CharacterController CharacterController { get; private set; }
public Rigidbody Rigidbody { get; private set; }
#region
#region
private static readonly int StartThrowHash = Animator.StringToHash("startThrow");
private static readonly int LureThrownHash = Animator.StringToHash("lureThrown");
private static readonly int PrepareThrowHash = Animator.StringToHash("prepareThrow");
private static readonly int LeftHandHash = Animator.StringToHash("leftHand");
private static readonly int MoveSpeedHash = Animator.StringToHash("moveSpeed");
private static readonly int BoatVelocityHash = Animator.StringToHash("boatVelocity");
private static readonly int BoatDirHash = Animator.StringToHash("boatDir");
private static readonly int BoatHash = Animator.StringToHash("boat");
private static readonly int CastingHash = Animator.StringToHash("casting");
private static readonly int TelestickHash = Animator.StringToHash("telestick");
private static readonly int TelestickPullHash = Animator.StringToHash("telestick_pull");
private static readonly int UseRodPodHash = Animator.StringToHash("use_rod_pod");
private static readonly int ItemSourceHash = Animator.StringToHash("item_source");
private static readonly int ItemDestHash = Animator.StringToHash("item_dest");
private static readonly int RodReadyHash = Animator.StringToHash("rod_ready");
private static readonly int HitchRecoverDirHash = Animator.StringToHash("hitchRecoverDir");
private static readonly int HitchRecoverHash = Animator.StringToHash("hitchRecover");
private static readonly int SitOrStandHash = Animator.StringToHash("sitOrStand");
private static readonly int ShtekerHash = Animator.StringToHash("shteker");
private static readonly int ItemInHandsHash = Animator.StringToHash("item_in_hands");
private static readonly int ChangeItemHash = Animator.StringToHash("change_item");
private static readonly int ItemTypeHash = Animator.StringToHash("item_type");
private static readonly int ItemActionHash = Animator.StringToHash("item_action");
private static readonly int ItemActionPowerHash = Animator.StringToHash("item_action_power");
private static readonly int PodsakActionHash = Animator.StringToHash("podsak_action");
private static readonly int FishingFinalHash = Animator.StringToHash("fishing_final");
private static readonly int SpinOrTeleHash = Animator.StringToHash("spin_or_tele");
private static readonly int TwitchHash = Animator.StringToHash("twitch");
private static readonly int TwitchDirHash = Animator.StringToHash("twitch_dir");
private static readonly int ThrowSpeedMultHash = Animator.StringToHash("throw_speed_mult");
private static readonly int ConvTestHash = Animator.StringToHash("conv_test");
private static readonly int BoatPoseHash = Animator.StringToHash("boat_pose");
private static readonly int QuadDirectionHash = Animator.StringToHash("quad_direction");
private static readonly int StretchMaxHash = Animator.StringToHash("stretch_max");
private static readonly int ExamineItemHash = Animator.StringToHash("examine_item");
private static readonly int TillerDirectionHash = Animator.StringToHash("tiller_direction");
private static readonly int TestTriggerHash = Animator.StringToHash("test_trigger");
private static readonly int ThrowModeHash = Animator.StringToHash("throw_mode");
private static readonly int PullUpRodHash = Animator.StringToHash("pull_up_rod");
public bool StartThrow
{
get => Animator.GetBool(StartThrowHash);
set => Animator.SetBool(StartThrowHash, value);
}
public bool LureThrown
{
get => Animator.GetBool(LureThrownHash);
set => Animator.SetBool(LureThrownHash, value);
}
public bool PrepareThrow
{
get => Animator.GetBool(PrepareThrowHash);
set => Animator.SetBool(PrepareThrowHash, value);
}
public bool LeftHand
{
get => Animator.GetBool(LeftHandHash);
set => Animator.SetBool(LeftHandHash, value);
}
public float MoveSpeed
{
get => Animator.GetFloat(MoveSpeedHash);
set => Animator.SetFloat(MoveSpeedHash, value);
}
public float BoatVelocity
{
get => Animator.GetFloat(BoatVelocityHash);
set => Animator.SetFloat(BoatVelocityHash, value);
}
public float BoatDir
{
get => Animator.GetFloat(BoatDirHash);
set => Animator.SetFloat(BoatDirHash, value);
}
public bool Boat
{
get => Animator.GetBool(BoatHash);
set => Animator.SetBool(BoatHash, value);
}
public bool Casting
{
get => Animator.GetBool(CastingHash);
set => Animator.SetBool(CastingHash, value);
}
public bool Telestick
{
get => Animator.GetBool(TelestickHash);
set => Animator.SetBool(TelestickHash, value);
}
public bool TelestickPull
{
get => Animator.GetBool(TelestickPullHash);
set => Animator.SetBool(TelestickPullHash, value);
}
public bool UseRodPod
{
get => Animator.GetBool(UseRodPodHash);
set => Animator.SetBool(UseRodPodHash, value);
}
public int ItemSource
{
get => Animator.GetInteger(ItemSourceHash);
set => Animator.SetInteger(ItemSourceHash, value);
}
public int ItemDest
{
get => Animator.GetInteger(ItemDestHash);
set => Animator.SetInteger(ItemDestHash, value);
}
public bool RodReady
{
get => Animator.GetBool(RodReadyHash);
set => Animator.SetBool(RodReadyHash, value);
}
public float HitchRecoverDir
{
get => Animator.GetFloat(HitchRecoverDirHash);
set => Animator.SetFloat(HitchRecoverDirHash, value);
}
public void SetHitchRecoverTrigger()
{
Animator.SetTrigger(HitchRecoverHash);
}
public void ResetHitchRecoverTrigger()
{
Animator.ResetTrigger(HitchRecoverHash);
}
public float SitOrStand
{
get => Animator.GetFloat(SitOrStandHash);
set => Animator.SetFloat(SitOrStandHash, value);
}
public bool Shteker
{
get => Animator.GetBool(ShtekerHash);
set => Animator.SetBool(ShtekerHash, value);
}
public bool ItemInHands
{
get => Animator.GetBool(ItemInHandsHash);
set => Animator.SetBool(ItemInHandsHash, value);
}
public bool ChangeItem
{
get => Animator.GetBool(ChangeItemHash);
set => Animator.SetBool(ChangeItemHash, value);
}
public HandItemType ItemType
{
get => (HandItemType)Animator.GetInteger(ItemTypeHash);
set => Animator.SetInteger(ItemTypeHash, (int)value);
}
public void SetItemActionTrigger()
{
Animator.SetTrigger(ItemActionHash);
}
public void ResetItemActionTrigger()
{
Animator.ResetTrigger(ItemActionHash);
}
public float ItemActionPower
{
get => Animator.GetFloat(ItemActionPowerHash);
set => Animator.SetFloat(ItemActionPowerHash, value);
}
public bool PodsakAction
{
get => Animator.GetBool(PodsakActionHash);
set => Animator.SetBool(PodsakActionHash, value);
}
public bool PullUpRod
{
get => Animator.GetBool(PullUpRodHash);
set => Animator.SetBool(PullUpRodHash, value);
}
public float FishingFinal
{
get => Animator.GetFloat(FishingFinalHash);
set => Animator.SetFloat(FishingFinalHash, value);
}
public float SpinOrTele
{
get => Animator.GetFloat(SpinOrTeleHash);
set => Animator.SetFloat(SpinOrTeleHash, value);
}
public void SetTwitchTrigger()
{
Animator.SetTrigger(TwitchHash);
}
public void ResetTwitchTrigger()
{
Animator.ResetTrigger(TwitchHash);
}
public float TwitchDir
{
get => Animator.GetFloat(TwitchDirHash);
set => Animator.SetFloat(TwitchDirHash, value);
}
public float ThrowSpeedMult
{
get => Animator.GetFloat(ThrowSpeedMultHash);
set => Animator.SetFloat(ThrowSpeedMultHash, value);
}
public void SetConvTestTrigger()
{
Animator.SetTrigger(ConvTestHash);
}
public void ResetConvTestTrigger()
{
Animator.ResetTrigger(ConvTestHash);
}
public int BoatPose
{
get => Animator.GetInteger(BoatPoseHash);
set => Animator.SetInteger(BoatPoseHash, value);
}
public float QuadDirection
{
get => Animator.GetFloat(QuadDirectionHash);
set => Animator.SetFloat(QuadDirectionHash, value);
}
public bool StretchMax
{
get => Animator.GetBool(StretchMaxHash);
set => Animator.SetBool(StretchMaxHash, value);
}
public void SetExamineItemTrigger()
{
Animator.SetTrigger(ExamineItemHash);
}
public void ResetExamineItemTrigger()
{
Animator.ResetTrigger(ExamineItemHash);
}
public float TillerDirection
{
get => Animator.GetFloat(TillerDirectionHash);
set => Animator.SetFloat(TillerDirectionHash, value);
}
public void SetTestTrigger()
{
Animator.SetTrigger(TestTriggerHash);
}
public void ResetTestTrigger()
{
Animator.ResetTrigger(TestTriggerHash);
}
public ThrowModeEnum ThrowMode
{
get
{
var val = Animator.GetInteger(ThrowModeHash);
return (ThrowModeEnum)val;
}
set => Animator.SetInteger(ThrowModeHash, (int)value);
}
#endregion
#region
/// <summary>
/// 抛竿开始
/// </summary>
public void RodForceThrowStart()
{
// if (Player.Fsm.CurrentState is PlayerThrow playerThrow)
// {
// playerThrow.RodForceThrowStart();
// }
}
#endregion
#endregion
private void Awake()
{
Animator = GetComponent<Animator>();
LookAtIK = GetComponent<LookAtIK>();
CharacterController = GetComponent<CharacterController>();
Rigidbody = GetComponent<Rigidbody>();
LookAtIK.enabled = false;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 553e656eacf648afb33751a88352d216
timeCreated: 1757836335

View File

@@ -98,7 +98,7 @@ namespace NBF.Fishing2
{
App.Main.EventComponent.Publish(new NumericChange()
{ MapUnit = self.GetParent<MapUnit>(), New = value, Old = oldValue, NumericType = numericType });
}
}
}
public static long GetByKey(this NumericComponent self, int key)

View File

@@ -3,6 +3,9 @@
public static class NumericType
{
public const int Max = 10000;
/// <summary>
/// 手电筒
/// </summary>
public const int Flashlight = 100;
}
}