Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.Container Class Reference
Inheritance diagram for AC.Container:
AC.ITranslatable AC.IItemReferencer

Public Member Functions

void Interact ()
 
void Open ()
 
void Close ()
 
void Add (int _id, int amount)
 Adds an inventory item to the Container's contents. More...
 
void Add (InvInstance addInstance)
 Adds an inventory item to the Container's contents. More...
 
void Remove (int itemID, int amount)
 
void Remove (InvInstance invInstance)
 
void Remove (int itemID)
 
void RemoveAll ()
 
int GetCount (int invID)
 Gets the number of instances of a particular inventory item stored within the Container. More...
 
void InsertAt (InvInstance itemInstance, int index, int amountOverride=0)
 Adds an inventory item to the Container's contents, at a particular index. More...
 
string GetLabel (int languageNumber=0)
 Gets the Container's label text in a given language More...
 
int GetNumItemReferences (int itemID)
 
int UpdateItemReferences (int oldItemID, int newItemID)
 
string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner (int index)
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer (int index)
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 

Public Attributes

List< ContainerItemitems = new List<ContainerItem> ()
 
bool limitToCategory
 
List< int > categoryIDs = new List<int> ()
 
int maxSlots = 0
 
bool swapIfFull = false
 
string label
 
int labelLineID = -1
 

Protected Member Functions

void Awake ()
 
void OnEnable ()
 
void Start ()
 
void OnDisable ()
 
void CreateDefaultInstances ()
 

Protected Attributes

InvCollection invCollection = new InvCollection ()
 

Properties

int Count [get]
 
int FilledSlots [get]
 
InvCollection InvCollection [get, set]
 
bool IsFull [get]
 

Detailed Description

This component that is used to store a local set of inventory items within a scene. The items stored here are separate to those held by the player, who can retrieve or place items in here for safe-keeping.

Member Function Documentation

◆ Add() [1/2]

void AC.Container.Add ( int  _id,
int  amount 
)

Adds an inventory item to the Container's contents.

Parameters
_idThe ID number of the InvItem to add
amountHow many instances of the inventory item to add

◆ Add() [2/2]

void AC.Container.Add ( InvInstance  addInstance)

Adds an inventory item to the Container's contents.

Parameters
addInstanceThe instance of the InvItem to add

◆ CanTranslate()

bool AC.Container.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ Close()

void AC.Container.Close ( )

Closes the container

◆ GetCount()

int AC.Container.GetCount ( int  invID)

Gets the number of instances of a particular inventory item stored within the Container.

Parameters
invIDThe ID number of the InvItem to search for
Returns
The number of instances of the inventory item stored within the Container

◆ GetLabel()

string AC.Container.GetLabel ( int  languageNumber = 0)

Gets the Container's label text in a given language

Parameters
languageNumberThe language index, where 0 = the game's default language
Returns
The label text

◆ GetNumTranslatables()

int AC.Container.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.Container.GetOwner ( int  index)

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Parameters
indexThe index of the translatable text
Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetTranslatableString()

string AC.Container.GetTranslatableString ( int  index)

Gets the text to be translated, given its index.

Parameters
indexThe index of the translatable text
Returns
The text to be translated

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.Container.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.Container.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ HasExistingTranslation()

bool AC.Container.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ InsertAt()

void AC.Container.InsertAt ( InvInstance  itemInstance,
int  index,
int  amountOverride = 0 
)

Adds an inventory item to the Container's contents, at a particular index.

Parameters
itemInstanceThe instance of the item to place within the Container
_indexThe index number within the Container's current contents to insert the new item
countIf >0, the quantity of the item to be added. Otherwise, the same quantity as _item will be added

◆ Interact()

void AC.Container.Interact ( )

An alias of Open

◆ Open()

void AC.Container.Open ( )

Activates the Container. If a Menu with an appearType = AppearType.OnContainer, it will be enabled and show the Container's contents.

◆ OwnerIsPlayer()

bool AC.Container.OwnerIsPlayer ( int  index)

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Parameters
indexThe index of the translatable text
Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ RemoveAll()

void AC.Container.RemoveAll ( )

Removes all inventory items from the Container's contents.

◆ SetTranslationID()

void AC.Container.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.

Member Data Documentation

◆ categoryIDs

List<int> AC.Container.categoryIDs = new List<int> ()

The category IDs to limit the display of inventory items by, if limitToCategory = True

◆ items

List<ContainerItem> AC.Container.items = new List<ContainerItem> ()

The Containers default list of items

◆ label

string AC.Container.label

The Container's label text

◆ labelLineID

int AC.Container.labelLineID = -1

A unique identifier for the label's translation

◆ limitToCategory

bool AC.Container.limitToCategory

If True, only inventory items (InvItem) with a specific category will be displayed

◆ maxSlots

int AC.Container.maxSlots = 0

If > 0, the maximum number of item slots the Container can hold

◆ swapIfFull

bool AC.Container.swapIfFull = false

If True, and maxSlots > 0, then attempting to place an item in the Container when full will result in the item being swapped with that in the occupied slot

Property Documentation

◆ Count

int AC.Container.Count
get

The total number of items

◆ FilledSlots

int AC.Container.FilledSlots
get

The total number of filled slots

◆ InvCollection

InvCollection AC.Container.InvCollection
getset

The Container's associated InvCollection, where item data is stored

◆ IsFull

bool AC.Container.IsFull
get

Returns True if the number of filled slots is that of the maxSlots, if maxSlots > 0