summaryrefslogtreecommitdiff
path: root/GameCode/StunPlayer.cs
blob: c131626ed95ff8ef3ae7581b3a3700e00e6d39a3 (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
using UnityEngine;

public class StunPlayer : MonoBehaviour
{
	public enum TargetPlayer
	{
		OtherPlayer,
		Self
	}

	public TargetPlayer targetPlayer;

	public float time = 0.5f;

	private Player target;

	public void Go()
	{
		if (!target)
		{
			target = GetComponentInParent<Player>();
			if (targetPlayer == TargetPlayer.OtherPlayer)
			{
				target = PlayerManager.instance.GetOtherPlayer(target);
			}
		}
		target.data.stunHandler.AddStun(time);
	}
}