From 766cdff5ffa72b65d7f106658d1603f47739b2ba Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 27 Oct 2023 11:05:14 +0800 Subject: + init --- GameCode/SpawnMinion.cs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 GameCode/SpawnMinion.cs (limited to 'GameCode/SpawnMinion.cs') 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(); + level = GetComponentInParent(); + } + + 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(); + component.SetAI(data.player); + component.player.playerID = data.player.playerID; + component.isPlaying = true; + card.GetComponent().Pick(component.player.teamID, forcePick: true); + gameObject.GetComponentInChildren().ToggleSimpleSkin(isSimple: true); + component.healthHandler.DestroyOnDeath = true; + } + } +} -- cgit v1.1-26-g67d0