summaryrefslogtreecommitdiff
path: root/Assets/Scripts/AbilitySystem/AbilitySystem.cs
blob: ce4ff49edd83cb5406993532a561250dd06fe383 (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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 每个角色拥有一个ablity system
/// </summary>
public class AbilitySystem
{
	/// <summary>
	/// 当前执行的ability
	/// </summary>
	private AbilityBase m_Currrent; 

	public AbilityBase Current
	{
		get
		{
			return m_Currrent;
		}
	}

	private List<AbilityBase> m_Abilities;

	public void ForceStart(AbilityBase ability)
	{
		if (ability == null)
			return;
		ability.OnEnter();
	}

	public void AddAbility(AbilityBase ability)
	{
		m_Abilities.Add(ability);
	}

	public void OnUpdate()
	{
		if(m_Currrent != null)
		{
			m_Currrent.OnUpdate();
		}
	}

}