Esempio n. 1
0
    public override void Attack(GuardAbs guardObj)
    {
        GoldCarrier gc = guardObj.gameObject.GetComponent <GoldCarrier>();

        if (gc == null || gos.Contains(gc.gameObject))
        {
            return;
        }

        gos.Add(gc.gameObject);
        UnityEventCenter.SendMessage <AudioEvent>(new AudioEvent(gameObject, clip_1));
        if (guardObj.getGuardLevel() <= getAttackLevel())
        {
            //等级相同,摧毁对方(只有超载矿车)
            if (guardObj.DestrotyGameObj(this))
            {    //成功摧毁对方
                TryDestroy(this);
            }
        }
        else
        {
            //等级高于检查站,则扣钱
            int gold = gc.popGold();
            gc.setGoldAmounts(Mathf.FloorToInt(gold * tax));
        }
    }
Esempio n. 2
0
 public override void Attack(GuardAbs guardObj)
 {
     if (guardObj.getGuardLevel() <= getAttackLevel() && guardObj.gameObject.layer == Layers.VEHICLE)
     {
         if (guardObj.DestrotyGameObj(this))
         {
             UnityEventCenter.SendMessage <AudioEvent>(new AudioEvent(gameObject, clip));
             TryDestroy(this);
         }
     }
 }