From 909eb9c31f1c93119f2889fececabde88e8493c4 Mon Sep 17 00:00:00 2001 From: samJa Date: Thu, 20 Aug 2015 14:13:05 -0400 Subject: [PATCH] - Removed useless comments. --- Assets/Scripts/Squad.cs | 57 ++++++----------------------------------- Assets/Scripts/Unit.cs | 18 +++---------- 2 files changed, 11 insertions(+), 64 deletions(-) diff --git a/Assets/Scripts/Squad.cs b/Assets/Scripts/Squad.cs index cf5a7ff..0a03176 100644 --- a/Assets/Scripts/Squad.cs +++ b/Assets/Scripts/Squad.cs @@ -48,17 +48,6 @@ public class Squad : Unit _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 void Update () { @@ -79,17 +68,13 @@ public class Squad : Unit if (_numberOfAliveSoldiers > 0) return; // first release all humans ... AbandonUnits(Humans.Count); - // then we destroy the squad - //DestroyUnit(); IsDead = true; } void OnTriggerEnter(Collider collider) { if (IsDead) return; - //var objectTag = collider.gameObject; - // check if the game object have an attached Unit class - //switch(objectTag.GetType()) + var unitComponent = collider.GetComponent(); if (unitComponent == null) @@ -113,31 +98,20 @@ public class Squad : Unit { if (unitComponent.IsDead) return; + _playerInRange = true; _enemySquad = collider.GetComponent(); - - /* try - { - AttackEnemySquad(unitComponent as Squad); - } - catch (InvalidCastException exception) - { - Debug.LogError(exception.ToString()); - //throw; - }*/ - } } void OnTriggerExit(Collider collider) { - if (collider.gameObject.tag != Tag && collider.gameObject.tag != TagLayerManager.Human) - { - _playerInRange = false; - this.gameObject.GetComponent().PlayAttackAnimation(false); - _enemySquad = null; - // collider.GetComponent().PlayAttackAnimation(false); - } + if (collider.gameObject.tag == Tag || collider.gameObject.tag == TagLayerManager.Human) + return; + + _playerInRange = false; + this.gameObject.GetComponent().PlayAttackAnimation(false); + _enemySquad = null; } #endregion @@ -308,17 +282,6 @@ public class Squad : Unit humanUnit.Tag = Tag; 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 @@ -374,10 +337,6 @@ public class Squad : Unit soldier.GetComponent().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()); } /// diff --git a/Assets/Scripts/Unit.cs b/Assets/Scripts/Unit.cs index 017ffc8..1c3b6cb 100644 --- a/Assets/Scripts/Unit.cs +++ b/Assets/Scripts/Unit.cs @@ -38,10 +38,6 @@ public class Unit : MonoBehaviour void Update() { - /* if (IsDead) - { - DestroyUnit(DyingTime); - }*/ if (IsCaptured) { var gapVector = new Vector3(TargetDestination.position.x + DestinationGap, TargetDestination.position.y,TargetDestination.position.z + DestinationGap); @@ -63,7 +59,7 @@ public class Unit : MonoBehaviour isDamaged = true; CurrentHP -= amountOfDamage; -// HealthSlider.value = CurrentHP; + //HealthSlider.value = CurrentHP; // TODO play hurt animation // TODO play hurt sound @@ -77,7 +73,7 @@ public class Unit : MonoBehaviour public void Death() { IsDead = true; - _character.PlayDeathAnimation(); + //_character.PlayDeathAnimation(); // TODO play death sound // TODO disable this gameobject movements. Debug.Log("Entered death function!"); @@ -105,12 +101,10 @@ public class Unit : MonoBehaviour { //TODO First play dead animation // retrieve the character behavior object, so that we can access it's animation properties... - //var character = GetComponent(); // play the death animation - //character.PlayDeathAnimation(); + _character.PlayDeathAnimation(); yield return new WaitForSeconds(_character.CurrrentAnimationLength()); - // then destroy the game object only 3 seconds after the animation //Destroy(this.transform.gameObject, dyingTime); } @@ -124,12 +118,6 @@ public class Unit : MonoBehaviour set { _currentHp = value > StartingHealth ? StartingHealth : value; - - /* if (CurrentHP <= 0) - { - IsDead = true; - StartCoroutine(DestroyUnit(DyingTime)); - }*/ } }