mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 20:13:02 +00:00
implement Panic state
This commit is contained in:
parent
c3074033b0
commit
eec25605ad
5 changed files with 50 additions and 0 deletions
|
@ -32,6 +32,7 @@ GameObject:
|
|||
- component: {fileID: 7181738364298022858}
|
||||
- component: {fileID: 2421064630445689714}
|
||||
- component: {fileID: 986117917908478283}
|
||||
- component: {fileID: 3998851707209983787}
|
||||
m_Layer: 11
|
||||
m_Name: States
|
||||
m_TagString: Untagged
|
||||
|
@ -343,6 +344,18 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 751a2e3fa7025a3448157779e2c99fe5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &3998851707209983787
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1154474390377672}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b9ff3ce5295c89b4fbfd4a6867fe0bfd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1273918895060814
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -85,6 +85,7 @@ namespace SanAndreasUnity.Behaviours
|
|||
public bool IsRunOn { get; set; }
|
||||
public bool IsSprintOn { get; set; }
|
||||
public bool IsJumpOn { get; set; }
|
||||
public bool IsPanicButtonOn { get; set; }
|
||||
|
||||
public Vector3 Velocity { get; private set; }
|
||||
/// <summary> Current movement input. </summary>
|
||||
|
@ -598,6 +599,7 @@ namespace SanAndreasUnity.Behaviours
|
|||
this.IsWalkOn = this.IsRunOn = this.IsSprintOn = false;
|
||||
this.Movement = Vector3.zero;
|
||||
this.IsJumpOn = false;
|
||||
this.IsPanicButtonOn = false;
|
||||
}
|
||||
|
||||
public void OnButtonPressed (string buttonName)
|
||||
|
|
|
@ -96,6 +96,10 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
else
|
||||
return typeof(SprintState);
|
||||
}
|
||||
else if (ped.IsPanicButtonOn)
|
||||
{
|
||||
return typeof(PanicState);
|
||||
}
|
||||
else
|
||||
{
|
||||
return typeof(StandState);
|
||||
|
|
20
Assets/Scripts/Behaviours/Ped/States/PanicState.cs
Normal file
20
Assets/Scripts/Behaviours/Ped/States/PanicState.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using SanAndreasUnity.Importing.Animation;
|
||||
|
||||
namespace SanAndreasUnity.Behaviours.Peds.States
|
||||
{
|
||||
|
||||
public class PanicState : BaseMovementState
|
||||
{
|
||||
public override AnimId movementAnim => new AnimId(AnimGroup.WalkCycle, AnimIndex.Panicked);
|
||||
public override AnimId movementWeaponAnim => this.movementAnim;
|
||||
|
||||
|
||||
protected override void SwitchToAimState()
|
||||
{
|
||||
// don't switch to aim state
|
||||
// we will switch to aim state from other movement states
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Behaviours/Ped/States/PanicState.cs.meta
Normal file
11
Assets/Scripts/Behaviours/Ped/States/PanicState.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b9ff3ce5295c89b4fbfd4a6867fe0bfd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue