public void AddEnemy() { Mecha EnemyMecha = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.Mecha].AllocateGameObject <Mecha>(MechaContainer); List <MechaComponentInfo> enemyComponentInfos = new List <MechaComponentInfo>(); for (int i = -4; i <= 4; i++) { for (int j = -6; j <= 6; j++) { MechaComponentInfo mci; if (i == 0 && j == 0) { mci = new MechaComponentInfo(MechaComponentType.Core, new GridPos(i, j, GridPos.Orientation.Up), 500, 0); } else { mci = new MechaComponentInfo((MechaComponentType)Random.Range(1, Enum.GetNames(typeof(MechaComponentType)).Length), new GridPos(i, j, GridPos.Orientation.Up), 50, 5); } enemyComponentInfos.Add(mci); } } EnemyMecha.Initialize(new MechaInfo("Junk Mecha", MechaType.Enemy, enemyComponentInfos)); EnemyMecha.transform.position = new Vector3(10, 0, 10); EnemyMechas.Add(EnemyMecha); }
public void StartGame() { PlayerMecha?.PoolRecycle(); PlayerMecha = null; foreach (Mecha em in EnemyMechas) { em.PoolRecycle(); } EnemyMechas.Clear(); PlayerMecha = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.Mecha].AllocateGameObject <Mecha>(MechaContainer); PlayerMecha.Initialize(new MechaInfo("Solar 0", MechaType.Self, new List <MechaComponentInfo> { new MechaComponentInfo(MechaComponentType.Core, new GridPos(0, 0, GridPos.Orientation.Up), 300, 0), })); GameManager.Instance.MainCameraFollow.SetTarget(PlayerMecha.transform); GameManager.Instance.SetState(GameState.Fighting); HUDPanel.Initialize(); PlayerMecha.RefreshHUDPanelCoreLifeSliderCount(); }