working
This commit is contained in:
parent
4e91f448c9
commit
1b2611e5a9
90 changed files with 7029 additions and 2762 deletions
|
@ -2,106 +2,25 @@ using UnityEngine;
|
|||
using System.Collections.Generic;
|
||||
|
||||
|
||||
public class ArmyManager : MonoBehaviour
|
||||
public static class ArmyManager
|
||||
{
|
||||
private List<GameObject> enemyArmy = new List<GameObject>();
|
||||
private List<GameObject> playerArmy = new List<GameObject>();
|
||||
private GameObject enemyCrownDuck = null;
|
||||
private GameObject playerCrownDuck = null;
|
||||
[SerializeField] private GameManager gameManagerScript;
|
||||
private static List<GameObject> enemyArmy = new List<GameObject>();
|
||||
private static List<GameObject> playerArmy = new List<GameObject>();
|
||||
private static GameObject enemyCrownDuck = null;
|
||||
private static GameObject playerCrownDuck = null;
|
||||
|
||||
|
||||
public static List<AbstractUnit> getArmy(bool isEnemy)
|
||||
{
|
||||
List<AbstractUnit> units = (isEnemy ? GlobalsVariable.AliveUnitsTeamB : GlobalsVariable.AliveUnitsTeamA);
|
||||
return units;
|
||||
}
|
||||
|
||||
|
||||
public static GameObject getCrownDuck(bool isEnemy)
|
||||
{
|
||||
return(isEnemy ? GlobalsVariable.QueenB.gameObject : GlobalsVariable.QueenA.gameObject);
|
||||
}
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//Debug.Log("Enemy Count : " + enemyArmy.Count);
|
||||
//Debug.Log("Player Count : " + playerArmy.Count);
|
||||
//Debug.Log(playerCrownDuck);
|
||||
}
|
||||
|
||||
public List<GameObject> getArmy(bool isEnemy){
|
||||
return(isEnemy ? enemyArmy : playerArmy);
|
||||
}
|
||||
|
||||
public void addTroopToArmy(bool isEnemy, GameObject Duck){
|
||||
(isEnemy ? enemyArmy : playerArmy).Add(Duck);
|
||||
}
|
||||
|
||||
public void removeTroopFromArmy(bool isEnemy, GameObject Duck)
|
||||
{
|
||||
(isEnemy ? enemyArmy : playerArmy).Remove(Duck);
|
||||
}
|
||||
|
||||
public void setCrownDuck(bool isEnemy, GameObject CrownDuck)
|
||||
{
|
||||
if (isEnemy) {
|
||||
enemyCrownDuck = CrownDuck;
|
||||
} else {
|
||||
playerCrownDuck = CrownDuck;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeCrownDuck(bool isEnemy)
|
||||
{
|
||||
if (isEnemy)
|
||||
{
|
||||
enemyCrownDuck = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerCrownDuck = null;
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject getCrownDuck(bool isEnemy)
|
||||
{
|
||||
return(isEnemy ? enemyCrownDuck : playerCrownDuck);
|
||||
}
|
||||
|
||||
public void kill(bool isEnemy, GameObject Duck, bool hasCrown)
|
||||
{
|
||||
removeTroopFromArmy(isEnemy, Duck);
|
||||
if (hasCrown)
|
||||
{
|
||||
gameManagerScript.endOfLevel(isEnemy);
|
||||
}
|
||||
removeTroopFromArmy(isEnemy, gameObject);
|
||||
}
|
||||
|
||||
public void giveCrownDuckTo(bool isEnemy, GameObject duckToCrown)
|
||||
{
|
||||
if ((isEnemy ? enemyCrownDuck : playerCrownDuck) != null)
|
||||
{
|
||||
(isEnemy ? enemyCrownDuck : playerCrownDuck).GetComponent<BaseDuckScript>().loseMyCrown();
|
||||
if (isEnemy)
|
||||
{
|
||||
enemyCrownDuck = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerCrownDuck = null;
|
||||
}
|
||||
}
|
||||
|
||||
//becomeCrownDuck will call army manager later and set it locally
|
||||
duckToCrown.GetComponent<BaseDuckScript>().becomeCrownDuck();
|
||||
}
|
||||
|
||||
public void removeCrownDuckFrom(bool isEnemy, GameObject duckToRemoveCrown)
|
||||
{
|
||||
(isEnemy ? enemyCrownDuck : playerCrownDuck).GetComponent<BaseDuckScript>().loseMyCrown();
|
||||
if (isEnemy)
|
||||
{
|
||||
enemyCrownDuck = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerCrownDuck = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue