Exemple #1
0
 public void Death()
 {
     if (currentHealth <= 0)
     {
         achievManager.EarnSlayingAchievment();
         this.tag = "Lootable";
         this.gameObject.transform.parent.tag = "Lootable";
         isNotDead = false;
         GetComponent <BoxCollider> ().enabled = false;
         this.transform.GetChild(2).gameObject.SetActive(true);
         currentHealth = 0;
         playerWorldInteractions.DrawEnemyHealth(this.GetComponent <EnemyStats>());
         StopCoroutine(Attack(GameObject.FindGameObjectWithTag("Player")));
         //this.GetComponent<Animation> ().Stop ("attack");
         if (!playedOnce)
         {
             this.GetComponent <Animation> ().Play(animation: "die");
             GetComponent <NavMeshAgent> ().speed = 0;
             playedOnce             = true;
             plManager.XpToLevelUp += playerCalc.CalculateXpToEarn(plManager.Level, level);
             playerCalc.CalculateLevelUp(plManager.XpToLevelUp, plManager.MaxXp);
             questProg.CalculateDropChance();
         }
     }
 }
Exemple #2
0
    public void DropAnItem()
    {
        generateLootAmount = Random.Range(0, 4);

        for (int i = 0; i < generateLootAmount; i++)
        {
            myItems.Add(dropManager.GetComponent <DropItemList> ().DropAnItem());
        }
        Debug.Log(questProg.CalculateDropChance());
        if (questProg.CalculateDropChance())
        {
            Debug.Log("I dropped a quest Item");
            questProg.AddToProgress(0);
            myItems.Add(itemDb.database[itemDb.database.Count - 1]);
        }
        dropedItemsOnce = true;
        GenerateTheLootBox();
    }