using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Squad : Unit
{
///
/// List of non attackable units.
///
private List humans;
///
/// List of attackable units.
///
private List soldiers;
// Use this for initialization
void Start ()
{
humans = new List();
soldiers = new List();
}
// Update is called once per frame
void Update ()
{
// TODO execute movement command
// TODO Check if all the units are dead
// if yes destroy
if (soldiers.Count == 0)
{
// then we destroy the squad
DestroyUnit();
}
}
void addHuman(Unit humanUnit)
{
humans.Add(humanUnit);
}
void addSoldier(Unit soldierUnit)
{
soldiers.Add(soldierUnit);
}
///
/// Dispose of a human unit and heal all the soldiers with a percentage depending
/// of the number of remaining soldiers.
///
/// The human to dispose
void healSquad(Unit humanUnit )
{
var percentageOfHpToHeal = ( humanUnit.Hp / soldiers.Count );
foreach (var soldier in soldiers)
{
soldier.Hp += soldier.Hp * ( 1 + percentageOfHpToHeal );
}
// dispose of the human unit
removeHuman(humanUnit);
}
///
/// Abandon a specified amount of units.
///
/// The number of units to abandon
void AbandonUnits(int nbUnits)
{
humans.RemoveRange(0,nbUnits);
}
///
/// Remove the selected soldier from the unit list.
///
/// the corresponding soldier that we want to remove
void removeSoldier(Unit soldierUnit)
{
soldiers.Remove(soldierUnit);
}
///
/// Remove the selected human from the human list.
///
/// the corresponding human that we want to remove
void removeHuman(Unit humanUnit)
{
humans.Remove(humanUnit);
}
void transformHuman()
{
}
}