Esempio n. 1
0
 private void EnemyDie()
 {
     if (MonsterStat.FoodToDrop.Length > 0)
     {
         if (Random.value < 0.25f)  // giving a 20% chance flat to drop food
         {
             Food drop = MonsterStat.FoodToDrop.RandomOrDefault();
             if (drop != null)
             {
                 FoodDrop dropObject = Instantiate(ResourceLocator.instance.FoodDropPrefab, m_Actor.CurrentPosition, Quaternion.identity).GetComponent <FoodDrop>();
                 dropObject.foodObject = drop;
                 dropObject.ApplyFood();
             }
         }
     }
 }
Esempio n. 2
0
 private void OnInteractedWith(Collider2D other)
 {
     if (other.name.Contains("Downstairs"))  // this is bad lol
     {
         DungeonManager.instance.GoDeeper();
     }
     else if (other.GetComponent <FoodDrop>() != null)
     {
         FoodDrop whatIGot = other.GetComponent <FoodDrop>();
         ResourceLocator.instance.PlayerPickedUpFood(whatIGot.foodObject);
         Destroy(other.gameObject);
     }
     else if (other.GetComponent <ResourceDrop>())
     {
         ResourceDrop r = other.GetComponent <ResourceDrop>();
         ResourceLocator.instance.PlayerGotResource(r.ResourceType, r.Amount);
         Destroy(other.gameObject);
     }
     else if (other.name.Contains("Upstairs"))
     {
         DungeonHUD.instance.ShowGoToCity();
     }
 }