Initial import
This commit is contained in:
parent
71fb5e578f
commit
3cb9eb5031
69 changed files with 4197 additions and 0 deletions
66
Assets/Battle/BattleController.cs
Normal file
66
Assets/Battle/BattleController.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BattleController : MonoBehaviour
|
||||
{
|
||||
public HeroId[] heroIds;
|
||||
public MonsterId[] monsterIds;
|
||||
|
||||
public HeroInfoUI heroUIPrefab;
|
||||
public GameObject uiCanvas;
|
||||
|
||||
public BattleHero[] heroes;
|
||||
private GameObject[] heroSprites;
|
||||
private HeroInfoUI[] heroUIs;
|
||||
|
||||
public BattleMonster[] monsters;
|
||||
private GameObject[] monsterSprites;
|
||||
private HeroInfoUI[] monsterUIs;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
heroes = new BattleHero[3];
|
||||
heroSprites = new GameObject[3];
|
||||
heroUIs = new HeroInfoUI[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
HeroId id = heroIds[i];
|
||||
|
||||
heroes[i] = new BattleHero(id);
|
||||
heroes[i].init();
|
||||
|
||||
heroSprites[i] = HeroDatabase.createHeroSprite(id);
|
||||
heroSprites[i].name = "Hero" + i + "_Sprite";
|
||||
heroSprites[i].transform.position = new Vector3(-6 + 6 * i, 0, 0);
|
||||
|
||||
heroUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
|
||||
heroUIs[i].target = heroSprites[i];
|
||||
heroUIs[i].battleParticipant = heroes[i];
|
||||
}
|
||||
|
||||
monsters = new BattleMonster[3];
|
||||
monsterSprites = new GameObject[3];
|
||||
monsterUIs = new HeroInfoUI[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
MonsterId id = monsterIds[i];
|
||||
|
||||
monsters[i] = MonsterDatabase.createMonsterScript(id);
|
||||
monsters[i].init();
|
||||
|
||||
monsterSprites[i] = MonsterDatabase.createMonsterSprite(id);
|
||||
monsterSprites[i].name = "Monster" + i + "_Sprite";
|
||||
monsterSprites[i].transform.position = new Vector3(-6 + 6 * i, 3, 0);
|
||||
|
||||
monsterUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
|
||||
monsterUIs[i].target = monsterSprites[i];
|
||||
monsterUIs[i].battleParticipant = monsters[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue