summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar/Conditions/ConditionCheckJumpState.cs
blob: 98859483b994fc481d2cba02aff3ff3725b2ce6e (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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ConditionCheckJumpState : ConditionBase
{
	JumpState m_State;
	JumpState.Stage m_Stage;
	JumpState.Direction m_Direction;

	public ConditionCheckJumpState(JumpState state, JumpState.Stage stage = JumpState.Stage.None, JumpState.Direction direction = JumpState.Direction.None)
	{
		m_State = state;
		m_State = state;
		m_Direction = direction;
	}

	public override bool Evaluate()
	{
		if (m_State == null)
			return false;
		if (m_Stage != JumpState.Stage.None && m_Direction != JumpState.Direction.None)
		{
			return m_State.CurStage == m_Stage
				&& m_State.CurDirection == m_Direction;
		}
		else if (m_Stage != JumpState.Stage.None && m_Direction == JumpState.Direction.None)
		{
			return m_State.CurStage == m_Stage;
		}
		else if (m_Stage == JumpState.Stage.None && m_Direction != JumpState.Direction.None)
		{
			return m_State.CurDirection == m_Direction;
		}
		else
			return false;
	}
}