public virtual void ApplyPickup(PickupTypes thisItemType, float itemValue)
    {
        print("Item Picked up: " + itemValue + thisItemType.ToString());

        if (Pcon)
        {
            Pcon.ApplyPickuptoPlayerCon(thisItemType, itemValue);
        }

        if (destroyOnPickup)
        {
            if (useAudio)
            {
                PickUpAudioSource.Play();
                Destroy(gameObject, pickUpSound.length);
            }
            else
            {
                Destroy(gameObject);
            }
        }
        if (respawnItemAfterPickup)
        {
            if (useAudio)
            {
                PickUpAudioSource.Play();
            }
            StartCoroutine("delayRespawnItem");
        }
    }
Exemplo n.º 2
0
 public void NewPickup(Vector3 position)
 {
     if (Random.Range(0, 100) <= DropChance)
     {
         //see if enemy drops an item according to DropChance
         PickupTypes type = RandomPickupType();
         Debug.Log("pickup: " + type.ToString());
         spawnedPickups.Add(Instantiate(Pickups.Find(p => p.type == type).gameObject, position, Quaternion.identity));
     }
 }
Exemplo n.º 3
0
 public void NewPickup(Vector3 position)
 {
     if (Random.Range(0, 100) <= DropChance)
     {
         //Ve se o Inimigo dropou um Item de acordo com a Chance de Drop.
         PickupTypes type = RandomPickupType();
         Debug.Log("pickup: " + type.ToString());
         spawnedPickups.Add(Instantiate(Pickups.Find(p => p.type == type).gameObject, position, Quaternion.identity));
     }
 }
    //Player Pickups
    #region Player Pickups
    public void ApplyPickuptoPlayerCon(PickupTypes type, float value)
    {
        print("player recieved pickup: " + type.ToString());
        switch (type)
        {
        case PickupTypes.health:
            currentHealth = Mathf.Clamp((currentHealth + value), 0, maxHealth);
            PlayerHudManager.instance.UpdateStatsPanel();
            if (playerDH)
            {
                playerDH.ApplyHealth(value, true);
            }
            break;

        case PickupTypes.keyPickup:
            currentKeys = (currentKeys + value);
            PlayerHudManager.instance.UpdateStatsPanel();
            break;



        case PickupTypes.xp:
            print("XP FIRED");
            if (currentXp + value >= xpToNextLevel)
            {
                PlayerLevelup();
            }
            currentXp += value;
            break;

        case PickupTypes.money:
            currentMoney += value;
            break;

        case PickupTypes.ammo:
            currentAmmo += value;
            break;

        case PickupTypes.popularity:
            currentPopularity += value;
            break;

        case PickupTypes.notoriety:
            currentNotoriety += value;
            break;

        case PickupTypes.points:
            currentPoints += value;
            break;

        case PickupTypes.armour:
            currentArmour += value;
            break;

        case PickupTypes.food:
            currentFood += value;

            if (currentFood > maxFood)
            {
                currentFood = maxFood;
            }
            break;
        }
    }