Ejemplo n.º 1
0
    public override void MyUpdate()
    {
        if (canBeFighted.getAttackNum() > 0)
        {
            if (MustDropOut)
            {
                Debug.Log("丢出东西, canBeFighted.AttNum = " + canBeFighted.getAttackNum());

                DropOut(Thing1, Thing1Number);
                DropOut(Thing2, Thing2Number);
                DropOut(Thing3, Thing3Number);
                DropOut(Thing4, Thing4Number);
                DropOut(Thing5, Thing5Number);
            }
            if (RandomlyDropOut)
            {
                int randomChoice;
                for (int i = 0; i < canBeFighted.getAttackNum(); i++)
                {
                    randomChoice = Random.Range(0, randomThingNumber);
                    DropOut(randomThingName[randomChoice], 1);
                }
            }
        }
        canBeFighted.Clear();
    }
Ejemplo n.º 2
0
    //统计CanBeFighted中的信息,包括统计相关、受击次数、毛伤害总和、最大打断类型
    protected virtual void SetStatistic()
    {
        hasSetStatistic = true;
        if (!hasBeenInitialized)
        {
            Debug.LogError("在Defence中,没有初始化该组件!");
        }

        AttackInterruptType localMaxInterrupt = AttackInterruptType.NONE;
        int localDamageSum = 0;

        if (attackedCheck.hasBeenAttacked())
        {
            foreach (AttackContent attack in attackedCheck.GetAttackedList())
            {
                if ((int)localMaxInterrupt < (int)attack.interruptType)
                {
                    localMaxInterrupt = attack.interruptType;
                }
                localDamageSum += attack.damage;
            }
        }

        maxInterrupt = localMaxInterrupt;
        damageSum    = localDamageSum;
        attackNum    = attackedCheck.getAttackNum();
    }