mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 22:43:11 +02:00
39 lines
966 B
C#
39 lines
966 B
C#
// TEMP CODE JUST FOR SHOWCASE PURPOSES
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SquadManager : MonoBehaviour
|
|
{
|
|
[SerializeField] GameObject squadPrefab;
|
|
Squad playerSquad;
|
|
Squad enemySquad;
|
|
private void Awake()
|
|
{
|
|
playerSquad = Instantiate(squadPrefab).GetComponent<Squad>();
|
|
playerSquad.gameObject.name = "Player Squad";
|
|
playerSquad.transform.SetParent(transform);
|
|
|
|
enemySquad = Instantiate(squadPrefab).GetComponent<Squad>();
|
|
enemySquad.gameObject.name = "Enemy Squad";
|
|
enemySquad.transform.SetParent(transform);
|
|
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
Debug.Log("Added initial soldiers to squad");
|
|
// add all ally soldiers to squad
|
|
var soldiers = FindObjectsOfType<Soldier>();
|
|
foreach(var soldier in soldiers)
|
|
{
|
|
if(soldier.GetOwnType() == Soldier.SoldierType.Ally)
|
|
{
|
|
playerSquad.TempAddSoldierToSquad(soldier);
|
|
}
|
|
}
|
|
|
|
enabled = false;
|
|
}
|
|
}
|