добавлены модели анимации персонажа
This commit is contained in:
1 parent
11d57bec19
commit
202a894140
824 files changed
+985212
-40
No files matched your search
@@ -22,6 +22,10 @@ public class PlayerAttack : MonoBehaviour
|
||||
[Header("Управление")]
|
||||
public bool allowLeftClick = true; // Разрешить ЛКМ для удара кулаком, когда огнестрел убран
|
||||
|
||||
[Header("Анимация")]
|
||||
public Animator animator;
|
||||
public string attackTrigger = "Attack";
|
||||
|
||||
private float nextAttackTime = 0f;
|
||||
private Camera mainCamera;
|
||||
|
||||
@@ -29,6 +33,11 @@ public class PlayerAttack : MonoBehaviour
|
||||
{
|
||||
mainCamera = Camera.main;
|
||||
|
||||
if (animator == null)
|
||||
{
|
||||
animator = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
if (audioSource == null)
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
@@ -85,6 +94,12 @@ public class PlayerAttack : MonoBehaviour
|
||||
audioSource.PlayOneShot(punchSound);
|
||||
}
|
||||
|
||||
// Запуск анимации удара
|
||||
if (animator != null && !string.IsNullOrEmpty(attackTrigger))
|
||||
{
|
||||
animator.SetTrigger(attackTrigger);
|
||||
}
|
||||
|
||||
Debug.Log("Игрок наносит рукопашный удар!");
|
||||
|
||||
HashSet<MutantHealth> damagedEnemies = new HashSet<MutantHealth>();
|
||||
|
||||
Reference in new issue
Block a user