добавлены модели анимации персонажа

This commit is contained in:
lapich committed 2026-10-20 04:05:05 +03:00
1 parent 11d57bec19
commit 202a894140
824 files changed
+985212 -40

No files matched your search

@@ -0,0 +1,32 @@
// -- Human Soldier Animations 2.0 | Kevin Iglesias --
// This script is a secondary script that works with HumanSoldierController.cs script.
// You can freely edit, expand, and repurpose it as needed. To preserve your custom changes when updating
// to future versions, it is recommended to work from a duplicate of this script.
// Contact Support: support@keviniglesias.com
using UnityEngine;
namespace KevinIglesias
{
public class HumanSoldierChangeWeaponSMB : StateMachineBehaviour
{
public SoldierWeapons weaponToDraw;
private HumanSoldierController hSC;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if(hSC == null)
{
hSC = animator.GetComponent<HumanSoldierController>();
}
if(hSC)
{
hSC.ChangeWeapon(weaponToDraw);
}
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a6873160ca816ed45b93ecd9139b8839
AssetOrigin:
serializedVersion: 1
productId: 340690
packageName: Human Soldier Animations FREE
packageVersion: 1.0
assetPath: Assets/Kevin Iglesias/Human Animations/Unity Demo Scenes/Human Soldier Animations/Scripts/HumanSoldierChangeWeaponSMB.cs
uploadId: 825260
@@ -0,0 +1,164 @@
// -- Human Soldier Animations 2.0 | Kevin Iglesias --
// This script is designed to showcase the animations included in the Unity demo scene for this asset.
// You can freely edit, expand, and repurpose it as needed. To preserve your custom changes when updating
// to future versions, it is recommended to work from a duplicate of this script.
// Contact Support: support@keviniglesias.com
using UnityEngine;
using System.Collections;
namespace KevinIglesias
{
public enum SoldierWeapons
{
None,
AssaultRifle,
Bazooka,
Rifle,
Gun,
DualGun
}
public enum SoldierPosition
{
StandUp,
Crouch,
Prone
}
public enum SoldierAction
{
Nothing,
HoldWeapon,
Salute,
WeaponChange,
Shoot01,
Shoot02,
Shoot03,
PreciseShoot01,
PreciseShoot02,
PreciseShoot03,
Grenade01L,
Grenade02L,
Grenade01R,
Grenade02R,
Reload,
Aim,
AimPrecise,
Damage01,
Damage02,
Damage03,
Damage04,
Damage05,
Death01,
Death02,
Death03,
Death04,
Death05,
ProneDeath,
ProneDamage,
Jump,
Roll,
RunSlide,
ChangeWeapons,
}
public enum SoldierMovement
{
NoMovement,
Walk,
Run,
Sprint,
StrafeL,
StrafeR
}
public enum UnsheatheWeapons
{
GetAssaultRifle,
GetRifle,
GetBazooka,
GetGun,
GetGuns
}
public class HumanSoldierController : MonoBehaviour
{
public Animator animator;
public SoldierWeapons equippedWeapon;
public SoldierPosition position;
public SoldierAction action;
public SoldierMovement movement;
public GameObject[] weapons;
private IEnumerator changingWeaponsCoroutine;
private int currentWeapon = 0;
void Update()
{
animator.SetTrigger(equippedWeapon.ToString());
animator.SetTrigger(position.ToString());
if(action != SoldierAction.Nothing && action != SoldierAction.ChangeWeapons)
{
animator.SetTrigger(action.ToString());
}
if(action == SoldierAction.ChangeWeapons)
{
if(changingWeaponsCoroutine == null)
{
changingWeaponsCoroutine = ChangingWeapons();
StartCoroutine(changingWeaponsCoroutine);
}
}else{
if(changingWeaponsCoroutine != null)
{
StopCoroutine(changingWeaponsCoroutine);
changingWeaponsCoroutine = null;
}
}
animator.SetTrigger(movement.ToString());
}
private IEnumerator ChangingWeapons()
{
currentWeapon++;
if(currentWeapon > 4)
{
currentWeapon = 0;
}
animator.SetTrigger(((UnsheatheWeapons)(currentWeapon)).ToString());
yield return new WaitForSeconds(1.5f);
changingWeaponsCoroutine = ChangingWeapons();
StartCoroutine(changingWeaponsCoroutine);
}
public void ChangeWeapon(SoldierWeapons newWeapon)
{
for(int i = 0; i < weapons.Length; i++)
{
weapons[i].SetActive(false);
}
weapons[(int)newWeapon-1].SetActive(true);
if(newWeapon == SoldierWeapons.DualGun)
{
weapons[(int)SoldierWeapons.Gun-1].SetActive(true);
}
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8a998aa24c80a144697fa8355c1bc1f7
AssetOrigin:
serializedVersion: 1
productId: 340690
packageName: Human Soldier Animations FREE
packageVersion: 1.0
assetPath: Assets/Kevin Iglesias/Human Animations/Unity Demo Scenes/Human Soldier Animations/Scripts/HumanSoldierController.cs
uploadId: 825260