SanAndreasUnity/Assets/Scripts/Behaviours/Ped/States/RunState.cs

38 lines
961 B
C#
Raw Normal View History

2020-05-31 17:07:22 +00:00
using UnityEngine;
using SanAndreasUnity.Utilities;
using SanAndreasUnity.Importing.Animation;
namespace SanAndreasUnity.Behaviours.Peds.States
{
public class RunState : BaseMovementState
{
public override AnimId movementAnim { get { return new AnimId (AnimGroup.WalkCycle, AnimIndex.Run); } }
public override AnimId movementWeaponAnim { get { return m_ped.CurrentWeapon.RunAnim; } }
protected override void UpdateAnims()
{
base.UpdateAnims();
if (!this.IsActiveState)
return;
2019-07-14 20:23:42 +00:00
if (m_model.LastAnimId.Equals(new AnimId(AnimGroup.Gun, AnimIndex.run_armed)))
{
// set y position of unnamed and root frame to 0
if (m_model.UnnamedFrame != null)
m_model.UnnamedFrame.transform.localPosition = m_model.UnnamedFrame.transform.localPosition.WithXAndZ();
if (m_model.RootFrame != null)
m_model.RootFrame.transform.localPosition = m_model.RootFrame.transform.localPosition.WithXAndZ();
2019-07-14 20:23:42 +00:00
}
}
2020-05-31 17:07:22 +00:00
}
}