summaryrefslogtreecommitdiff
path: root/GameCode/SpawnMinion.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameCode/SpawnMinion.cs')
-rw-r--r--GameCode/SpawnMinion.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/GameCode/SpawnMinion.cs b/GameCode/SpawnMinion.cs
new file mode 100644
index 0000000..2b28914
--- /dev/null
+++ b/GameCode/SpawnMinion.cs
@@ -0,0 +1,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;
+ }
+ }
+}