diff options
author | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
commit | 766cdff5ffa72b65d7f106658d1603f47739b2ba (patch) | |
tree | 34d7799a94dfa9be182825577583c0fa6dc935f7 /GameCode/SpawnMinion.cs |
+ init
Diffstat (limited to 'GameCode/SpawnMinion.cs')
-rw-r--r-- | GameCode/SpawnMinion.cs | 36 |
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; + } + } +} |