Ejemplo n.º 1
0
    IEnumerator Fight(Soldier target)
    {
        UnitBehaviour behaviour = unit.GetUnitData().GetBehaviour();
        int           range     = behaviour.GetAttackRange();

        //while(locomotion.IsInRange(this.GetPosition(), target.GetPosition(), range))
        while (true && target != null)
        {
            Debug.DrawLine(transform.position, target.transform.position, team.GetDebugColor(), behaviour.GetActionSpeed());

            behaviour.Attack(target);
            yield return(new WaitForSeconds(1 - behaviour.GetActionSpeed()));

            if (unitType == UnitType.healer)
            {
                if (target.GetHealth() == target.GetTotalHealth() || target.GetHealth() == 0)
                {
                    break;
                }
            }
            else
            {
                if (target.GetHealth() <= 0)
                {
                    target.gameObject.SetActive(false);
                    target.GetPosition().SetEmpty(true);
                    targetSoldiers.Remove(target);
                    target.GetTeam().OnUnitKilled();
                    break;
                }
            }
        }

        Battle();
    }
Ejemplo n.º 2
0
    public override void ApplyBuffEfect(Soldier target)
    {
        UnitBehaviour targetBehaviour = target.GetUnit().GetUnitData().GetBehaviour();

        targetBehaviour.SetActionSpeed(targetBehaviour.GetActionSpeed() + 0.2f);
    }