- Removed useless comments.

This commit is contained in:
samJa 2015-08-20 14:13:05 -04:00
parent 3a5294091b
commit 909eb9c31f
2 changed files with 11 additions and 64 deletions

View File

@ -48,17 +48,6 @@ public class Squad : Unit
_timer = 0f; _timer = 0f;
} }
//void Awake()
//{
/* InitializeSquad();
InitializeDefaultTagAndLayer();
CurrentHP = 255;
Debug.Log("Current HP" + CurrentHP) ;
Attack = ComputeAttackDamage();
_enemySquad = null;
_timer = 0f;*/
//}
// Update is called once per frame // Update is called once per frame
void Update () void Update ()
{ {
@ -79,17 +68,13 @@ public class Squad : Unit
if (_numberOfAliveSoldiers > 0) return; if (_numberOfAliveSoldiers > 0) return;
// first release all humans ... // first release all humans ...
AbandonUnits(Humans.Count); AbandonUnits(Humans.Count);
// then we destroy the squad
//DestroyUnit();
IsDead = true; IsDead = true;
} }
void OnTriggerEnter(Collider collider) void OnTriggerEnter(Collider collider)
{ {
if (IsDead) return; if (IsDead) return;
//var objectTag = collider.gameObject;
// check if the game object have an attached Unit class
//switch(objectTag.GetType())
var unitComponent = collider.GetComponent<Unit>(); var unitComponent = collider.GetComponent<Unit>();
if (unitComponent == null) if (unitComponent == null)
@ -113,31 +98,20 @@ public class Squad : Unit
{ {
if (unitComponent.IsDead) if (unitComponent.IsDead)
return; return;
_playerInRange = true; _playerInRange = true;
_enemySquad = collider.GetComponent<Squad>(); _enemySquad = collider.GetComponent<Squad>();
/* try
{
AttackEnemySquad(unitComponent as Squad);
}
catch (InvalidCastException exception)
{
Debug.LogError(exception.ToString());
//throw;
}*/
} }
} }
void OnTriggerExit(Collider collider) void OnTriggerExit(Collider collider)
{ {
if (collider.gameObject.tag != Tag && collider.gameObject.tag != TagLayerManager.Human) if (collider.gameObject.tag == Tag || collider.gameObject.tag == TagLayerManager.Human)
{ return;
_playerInRange = false; _playerInRange = false;
this.gameObject.GetComponent<CharacterBehavior>().PlayAttackAnimation(false); this.gameObject.GetComponent<CharacterBehavior>().PlayAttackAnimation(false);
_enemySquad = null; _enemySquad = null;
// collider.GetComponent<CharacterBehavior>().PlayAttackAnimation(false);
}
} }
#endregion #endregion
@ -308,17 +282,6 @@ public class Squad : Unit
humanUnit.Tag = Tag; humanUnit.Tag = Tag;
AddSoldier(humanUnit as Squad); AddSoldier(humanUnit as Squad);
// AddSoldier((VampireSquad) humanUnit) ) (VampireSquad or ZombieSquad)
/*if (Tag.Equals(TagLayerManager.VampirePlayer))
{
// add the vampire to the soldier list
AddSoldier((VampireSquad) humanUnit);
}
else
{
// add the zombie to the soldier list
AddSoldier((ZombieSquad)humanUnit);
}*/
} }
} }
else else
@ -374,10 +337,6 @@ public class Squad : Unit
soldier.GetComponent<CharacterBehavior>().PlayAttackAnimation(false); soldier.GetComponent<CharacterBehavior>().PlayAttackAnimation(false);
} }
} }
//TODO improve this method add the total of squad damage or to compute the reduce of hp, etc...
// compute the amount of hp reduced to this unit
//unit.Hp -= Attack; // we remove some hp of the unit that was
// targettedEnemySquad.ReceiveDamage(ComputeAttackDamage());
} }
/// <summary> /// <summary>

View File

@ -38,10 +38,6 @@ public class Unit : MonoBehaviour
void Update() void Update()
{ {
/* if (IsDead)
{
DestroyUnit(DyingTime);
}*/
if (IsCaptured) if (IsCaptured)
{ {
var gapVector = new Vector3(TargetDestination.position.x + DestinationGap, TargetDestination.position.y,TargetDestination.position.z + DestinationGap); var gapVector = new Vector3(TargetDestination.position.x + DestinationGap, TargetDestination.position.y,TargetDestination.position.z + DestinationGap);
@ -77,7 +73,7 @@ public class Unit : MonoBehaviour
public void Death() public void Death()
{ {
IsDead = true; IsDead = true;
_character.PlayDeathAnimation(); //_character.PlayDeathAnimation();
// TODO play death sound // TODO play death sound
// TODO disable this gameobject movements. // TODO disable this gameobject movements.
Debug.Log("Entered death function!"); Debug.Log("Entered death function!");
@ -105,12 +101,10 @@ public class Unit : MonoBehaviour
{ {
//TODO First play dead animation //TODO First play dead animation
// retrieve the character behavior object, so that we can access it's animation properties... // retrieve the character behavior object, so that we can access it's animation properties...
//var character = GetComponent<CharacterBehavior>();
// play the death animation // play the death animation
//character.PlayDeathAnimation(); _character.PlayDeathAnimation();
yield return new WaitForSeconds(_character.CurrrentAnimationLength()); yield return new WaitForSeconds(_character.CurrrentAnimationLength());
// then destroy the game object only 3 seconds after the animation // then destroy the game object only 3 seconds after the animation
//Destroy(this.transform.gameObject, dyingTime); //Destroy(this.transform.gameObject, dyingTime);
} }
@ -124,12 +118,6 @@ public class Unit : MonoBehaviour
set set
{ {
_currentHp = value > StartingHealth ? StartingHealth : value; _currentHp = value > StartingHealth ? StartingHealth : value;
/* if (CurrentHP <= 0)
{
IsDead = true;
StartCoroutine(DestroyUnit(DyingTime));
}*/
} }
} }