Exemplo n.º 1
0
    public void AttackAnimation(Creep creep)
    {
        int  towerLine       = tower.LinePosition;
        int  creepLine       = creep.GetLinePosition();
        bool isTargetForward = IsTargetFoward(creep.creepTransform);

        if (isTargetForward)   // target forward
        {
            animator.Play(Constants.ANIM_TOWER_ATTACK_FORWARD);
        }
        else
        {
            animator.Play(Constants.ANIM_TOWER_ATTACK_BACK);
        }
    }
Exemplo n.º 2
0
    public Tower GetTargetTower(Creep creep)
    {
        List <Tower> twrs   = lines [creep.GetLinePosition()].lineTowers;
        Tower        target = GetMainTargetTower(creep);
        float        temp   = float.MaxValue;

        for (int i = 0; i < twrs.Count; i++)
        {
            float dist = Mathf.Abs(twrs [i].towerTransform.position.x - creep.creepTransform.position.x);
            if (dist <= temp)
            {
                target = twrs [i];
                temp   = dist;
            }
        }
        return(target);
    }
Exemplo n.º 3
0
 public void RemoveCreepFromEnemyList(Creep creep)
 {
     lines [creep.GetLinePosition()].lineCreeps.Remove(creep);
     GameEvents.current.EnemyAppear();
 }
Exemplo n.º 4
0
 public void AddCreepToEnemyList(Creep creep)
 {
     lines [creep.GetLinePosition()].lineCreeps.Add(creep);
     GameEvents.current.EnemyAppear();
 }
Exemplo n.º 5
0
 public Tower GetMainTargetTower(Creep creep)
 {
     return(sortedTowers [creep.GetLinePosition()]);
 }