option for change visual character

This commit is contained in:
Vova
2024-04-28 15:17:19 +03:00
parent 38f8b297f2
commit fb2c0a0c5c
7 changed files with 290 additions and 240 deletions
+8 -3
View File
@@ -7,10 +7,9 @@ public class BlockingAnimation : Attribute { }
public abstract class BaseCharacter : MonoBehaviour
{
[SerializeField]
public NavMeshAgent _navAgent;
[SerializeField]
public Animator _animator;
protected NavMeshAgent _navAgent;
protected Animator _animator;
private const string WALK_VELOCITY = "WalkVelocity";
private readonly Queue<PlayerTasks> _tasks = new Queue<PlayerTasks>();
private PlayerTasks _currentTask;
@@ -18,6 +17,12 @@ public abstract class BaseCharacter : MonoBehaviour
private Action _OnAnimationFinish;
private AnimationStates _currentAnimation;
protected void IntCharacter()
{
_animator=GetComponentInChildren<Animator>();
}
private void Update()
{
if (PlayerHelper.IsBlockingAnimation(_currentAnimation))
+6
View File
@@ -0,0 +1,6 @@
using UnityEngine;
public class HoldPoint : MonoBehaviour
{
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 99527458161e16442b3fb76c8f585ec8
+4 -3
View File
@@ -8,8 +8,7 @@ public class Player : BaseCharacter
public event EventHandler<bool> OnContainerChanged;
public static Player Instance { get; private set; }
[SerializeField]
private Transform _holdPoint;
private HoldPoint _holdPoint;
private PlayerStates _currentActing;
@@ -43,6 +42,8 @@ public class Player : BaseCharacter
private void Start()
{
base.IntCharacter();
_holdPoint= GetComponentInChildren<HoldPoint>();
GameManager.Instance.Time.OnMinuteChanged += UpdateStatsByClock;
_animator.applyRootMotion = true;
_navAgent.updatePosition = false;
@@ -120,7 +121,7 @@ public class Player : BaseCharacter
public void SetContainerItem(ContainerItem containerItem)
{
containerItem.transform.parent = _holdPoint;
containerItem.transform.parent = _holdPoint.transform;
containerItem.transform.localPosition = Vector3.zero;
_containerItem = containerItem;
OnContainerChanged.Invoke(this,true);