Exemplo n.º 1
0
    private IEnumerator CheckForLoot(Transform lootTarget)
    {
        unitSM.currentlyLooting = true;
        print("CheckForLoot called, currentlyLooting = " + unitSM.currentlyLooting);
        yield return(new WaitForSeconds(unitStats.lootTime));

        GameObject potentialBuffGameObject = lootTarget.gameObject.GetComponent <Resource>().LootResource();

        if (potentialBuffGameObject.GetComponent <ObjectInfo>().isNothing == false)
        {
            Resource lootTargetResource = lootTarget.gameObject.GetComponent <Resource>();
            Buff     potentialBuff      = potentialBuffGameObject.GetComponent <Buff>();
            LootAction(potentialBuff, potentialBuffGameObject, lootTargetResource);
            lootTargetResource.AddGameObjectToKnowledgeOfLoot(gameObject);
        }
        unitDB.RebuildDB();
        unitSM.currentlyLooting = false;
        print("CheckForLoot exiting, currentlyLooting = " + unitSM.currentlyLooting);
    }