94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using System;
|
|
using RootMotion.FinalIK;
|
|
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
public enum PlayerState
|
|
{
|
|
idle = 0,
|
|
move = 1,
|
|
prepare = 2,
|
|
casting = 3,
|
|
fishing = 4,
|
|
baitFlies = 5,
|
|
fight = 6,
|
|
fishView = 7,
|
|
collectFish = 8,
|
|
throwFish = 9,
|
|
vehicle = 10,
|
|
swiming = 11,
|
|
flyModeDebug = 12,
|
|
vehicleFishing = 13,
|
|
preciseCastIdle = 14,
|
|
preciseCastThrow = 15
|
|
}
|
|
|
|
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 参数定义
|
|
|
|
public static readonly int IsSwiming = Animator.StringToHash("Swim");
|
|
|
|
public static readonly int ThrowFar = Animator.StringToHash("ThrowFar");
|
|
|
|
public static readonly int BoatDriving = Animator.StringToHash("BoatDriving");
|
|
|
|
public static readonly int BaitInWater = Animator.StringToHash("BaitInWater");
|
|
|
|
public static readonly int HeldRod = Animator.StringToHash("HeldRod");
|
|
|
|
public static readonly int RodArming = Animator.StringToHash("RodArming");
|
|
|
|
public static readonly int Forward = Animator.StringToHash("Forward");
|
|
|
|
public static readonly int Turn = Animator.StringToHash("Turn");
|
|
|
|
public static readonly int OnGround = Animator.StringToHash("OnGround");
|
|
|
|
public static readonly int RodRight = Animator.StringToHash("rod right");
|
|
|
|
public static readonly int RodForward = Animator.StringToHash("rod forward");
|
|
|
|
public static readonly int PreciseCast = Animator.StringToHash("Precise Cast");
|
|
|
|
public static readonly int PreciseIdle = Animator.StringToHash("Precise Idle");
|
|
|
|
#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;
|
|
}
|
|
}
|
|
} |