2022-05-20 11:51:59 +02:00
|
|
|
// TEMP CODE JUST FOR SHOWCASE PURPOSES
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-05-23 12:41:33 +02:00
|
|
|
public class SquadManager : MonoBehaviour
|
2022-05-20 11:51:59 +02:00
|
|
|
{
|
2022-05-23 12:41:33 +02:00
|
|
|
[SerializeField] GameObject squadPrefab;
|
2022-05-20 11:51:59 +02:00
|
|
|
Squad playerSquad;
|
2022-05-23 12:41:33 +02:00
|
|
|
Squad enemySquad;
|
2022-05-20 11:51:59 +02:00
|
|
|
private void Awake()
|
|
|
|
|
{
|
2022-05-23 12:41:33 +02:00
|
|
|
playerSquad = Instantiate(squadPrefab).GetComponent<Squad>();
|
|
|
|
|
playerSquad.gameObject.name = "Player Squad";
|
2022-05-23 12:57:50 +02:00
|
|
|
playerSquad.transform.SetParent(transform);
|
2022-05-23 12:41:33 +02:00
|
|
|
|
|
|
|
|
enemySquad = Instantiate(squadPrefab).GetComponent<Squad>();
|
|
|
|
|
enemySquad.gameObject.name = "Enemy Squad";
|
2022-05-23 12:57:50 +02:00
|
|
|
enemySquad.transform.SetParent(transform);
|
2022-05-23 12:41:33 +02:00
|
|
|
|
2022-05-20 11:51:59 +02:00
|
|
|
}
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2022-05-23 12:57:50 +02:00
|
|
|
Debug.Log("Added initial soldiers to squad");
|
2022-05-20 11:51:59 +02:00
|
|
|
// add all ally soldiers to squad
|
|
|
|
|
var soldiers = FindObjectsOfType<Soldier>();
|
|
|
|
|
foreach(var soldier in soldiers)
|
|
|
|
|
{
|
2022-05-23 14:04:53 +02:00
|
|
|
if(soldier.GetOwnTeam() == Soldier.Team.Ally)
|
2022-05-20 11:51:59 +02:00
|
|
|
{
|
|
|
|
|
playerSquad.TempAddSoldierToSquad(soldier);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enabled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|