Euras

PlayerMonsterInventory

Jan 31st, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class PlayerMonsterInventory : MonoBehaviour
  6. {
  7.     public List<GameObject> monsterList = new List<GameObject>(); // Main list container for all monsters
  8.     public const int inventoryCapacity = 19; // Only 20 monsters can be stored at once
  9.  
  10.     // Constructor for inventory
  11.     public PlayerMonsterInventory()
  12.     {
  13.         // Initialze capacity
  14.         monsterList.Capacity = inventoryCapacity;
  15.     }
  16.  
  17.     // Retreive details for all monsters in inventory
  18.     public void PrintInventoryInformation()
  19.     {
  20.         // Show number of monsters in inventory
  21.         Debug.Log("Monster Count: " + monsterList.Count);
  22.         foreach (GameObject monster in monsterList)
  23.         {
  24.             // Supply basic information for each monster
  25.             Debug.Log(
  26.                 "Name: " + monster.GetComponent<MonsterBase>().Name +
  27.                 " Health: " + monster.GetComponent<MonsterBase>().Health +
  28.                 " Level: " + monster.GetComponent<MonsterBase>().CurrentLevel +
  29.                 " Exp: " + monster.GetComponent<MonsterBase>().Experience +
  30.                 " Att: " + monster.GetComponent<MonsterBase>().Attack +
  31.                 " Def: " + monster.GetComponent<MonsterBase>().Defense
  32.                 );
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment