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

public class SpawnMinion : MonoBehaviour
{
	public GameObject card;

	public GameObject minionAI;

	public GameObject minion;

	private CharacterData data;

	private AttackLevel level;

	private void Start()
	{
		data = GetComponentInParent<CharacterData>();
		level = GetComponentInParent<AttackLevel>();
	}

	public void Go()
	{
		for (int i = 0; i < level.attackLevel; i++)
		{
			GameObject gameObject = Object.Instantiate(minion, base.transform.position + Vector3.up * (((float)i + 1f) * 0.5f), base.transform.rotation);
			Object.Instantiate(minionAI, gameObject.transform.position, gameObject.transform.rotation, gameObject.transform);
			CharacterData component = gameObject.GetComponent<CharacterData>();
			component.SetAI(data.player);
			component.player.playerID = data.player.playerID;
			component.isPlaying = true;
			card.GetComponent<ApplyCardStats>().Pick(component.player.teamID, forcePick: true);
			gameObject.GetComponentInChildren<PlayerSkinHandler>().ToggleSimpleSkin(isSimple: true);
			component.healthHandler.DestroyOnDeath = true;
		}
	}
}