Beispiel #1
0
 //called by Unit to fire the shoot-object, all initial calculation for a shot goes here
 public void InitShoot(AttackInfo aInfo, Transform shootP = null)
 {
     shootPoint = shootP;
     attackInfo = aInfo;
     InitShoot(aInfo.tgtUnit);
 }
Beispiel #2
0
        public void ApplyAttack(AttackInfo aInfo)
        {
            if (aInfo.aoeRange > 0)
            {
                if (aInfo.srcUnit.IsTower())
                {
                    List <Unit> tgtList = SpawnManager.GetUnitsWithinRange(this, aInfo.aoeRange);
                    for (int i = 0; i < tgtList.Count; i++)
                    {
                        if (tgtList[i] == this)
                        {
                            continue;
                        }
                        tgtList[i].ApplyAttack(new AttackInfo(aInfo.srcUnit, tgtList[i], false));
                    }
                }
            }

            if (IsDestroyed())
            {
                return;
            }

            if (aInfo.damage > 0)
            {
                if (aInfo.hit)
                {
                    TDTK.TextOverlay(aInfo.damage.ToString(), GetTargetPoint());

                    AnimPlayHit();

                    //~ if(sh>0){
                    //~ if(aInfo.damage<sh){
                    //~ sh-=aInfo.damage;
                    //~ aInfo.damage=0;
                    //~ }
                    //~ else{
                    //~ aInfo.damage-=sh;
                    //~ sh=0;
                    //~ }
                    //~ }
                    aInfo.damage = ApplyShieldDamage(aInfo.damage);
                    shStagger    = GetSHStagger();

                    hp -= aInfo.damage;
                }
                else
                {
                    TDTK.TextOverlay("missed", GetTargetPoint());
                }

                if (hp <= 0)
                {
                    Destroyed();
                    return;
                }
            }

            if (aInfo.UseEffect())
            {
                ApplyEffect(aInfo.effect);
            }
        }