summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Test/ArmorSoldierScript_States.cs
blob: 67eca58176a70e195fc0d2c271a92d4f737957ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public partial class ArmorSoldierScript : Avatar, IInteractable
{

	void SetupStates()
	{
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// states
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		IdleState idle = new IdleState(m_Animator, Anim_Idle);

		HurtState lightHurt = new HurtState(m_Animator, Anim_LightHurt);
		HurtState midiumHurt = new HurtState(m_Animator, Anim_MidiumHurt);
		HurtState heavyHurt = new HurtState(m_Animator, Anim_HeavyHurt);
		HurtState groundHurt = new HurtState(m_Animator, Anim_GroundHurt);
		HurtState airHurt = new HurtState(m_Animator, Anim_AirHurt);
		m_StateLightHurt = lightHurt;
		m_StateMidiumHurt = midiumHurt;
		m_StateHeavyHurt = heavyHurt;
		m_StateGroundHurt = groundHurt;
		m_StateAirHurt = airHurt;


		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// conditions
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		ConditionInAir condInAir = new ConditionInAir(m_BodyCollider);


		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// actions
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		ActionSwitchState switchToIdle = new ActionSwitchState(m_StateSystem, idle);
	
		Trigger trigger = null;


		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// state setup
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		// air hurt
		ConditionMotionAtEnd airAtEnd = new ConditionMotionAtEnd(m_Animator, Anim_AirHurt);
		trigger = new Trigger(And(airAtEnd, Not(condInAir)), switchToIdle);
		airHurt.AddTrigger(trigger);

		m_StateSystem.ForceStart(idle);
	}

}