Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class PlayerMonsterInventory : MonoBehaviour
- {
- public List<GameObject> monsterList = new List<GameObject>(); // Main list container for all monsters
- public const int inventoryCapacity = 19; // Only 20 monsters can be stored at once
- // Constructor for inventory
- public PlayerMonsterInventory()
- {
- // Initialze capacity
- monsterList.Capacity = inventoryCapacity;
- }
- // Retreive details for all monsters in inventory
- public void PrintInventoryInformation()
- {
- // Show number of monsters in inventory
- Debug.Log("Monster Count: " + monsterList.Count);
- foreach (GameObject monster in monsterList)
- {
- // Supply basic information for each monster
- Debug.Log(
- "Name: " + monster.GetComponent<MonsterBase>().Name +
- " Health: " + monster.GetComponent<MonsterBase>().Health +
- " Level: " + monster.GetComponent<MonsterBase>().CurrentLevel +
- " Exp: " + monster.GetComponent<MonsterBase>().Experience +
- " Att: " + monster.GetComponent<MonsterBase>().Attack +
- " Def: " + monster.GetComponent<MonsterBase>().Defense
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment