C# Класс Supermarket.Supermarket

Supermarket script. Contains product catalogue and directory information, manages shelves, and money.
Наследование: UnityEngine.MonoBehaviour, IEmptyShelfListener
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
ExitIcon UnityEngine.GameObject
IdleIcon UnityEngine.GameObject
WanderIcon UnityEngine.GameObject

Открытые методы

Метод Описание
AddListener ( IWalletListener listener ) : void
AddToDirectory ( string product, Shelf shelf ) : void

Adds the given shelf to the supermarket product directory. The directory shows which shelves stock which products

Awake ( ) : void
ClosestExit ( Vector3 position ) : GameObject

Gets the closest exit zone to the given position.

ClosestShelf ( Vector3 position, string product ) : Shelf

Gets the closest shelf to the given pposition that stocks the given product. Returns null if no shelf stocks the given product

Deposit ( float amount ) : void

Adds the given amount of money to the supermarkets cash pool

NextEmptyShelf ( ) : Shelf
NotifyDeposit ( float amountDeposited ) : void
NotifyShelfEmpty ( Shelf shelf, string product ) : void

Interface method. Called when a shelf runs out of the given product.

NotifyWithdrawal ( float amountWithdrawn ) : void
OccupiedCheckout ( ) : Checkout
RandomCheckout ( ) : Checkout

Selects a random checkout in this supermarket.

RandomExit ( ) : GameObject

Gets a random exit zone.

RandomPosition ( ) : Vector3

Gets a random position within the supermarket that is on the supermarket navmesh

RandomProduct ( ) : Product

Gets a random product with a random quantity from the supermarket catalogue

RemoveListener ( IWalletListener listener ) : void
Withdraw ( float amount ) : void

Withdraws the given amount of money from the supermarket's cash pool

Описание методов

AddListener() публичный Метод

public AddListener ( IWalletListener listener ) : void
listener IWalletListener
Результат void

AddToDirectory() публичный Метод

Adds the given shelf to the supermarket product directory. The directory shows which shelves stock which products
public AddToDirectory ( string product, Shelf shelf ) : void
product string The product key to add to the directory
shelf Shelf The shelf that stocks the product
Результат void

Awake() публичный Метод

public Awake ( ) : void
Результат void

ClosestExit() публичный Метод

Gets the closest exit zone to the given position.
public ClosestExit ( Vector3 position ) : GameObject
position UnityEngine.Vector3 The position to check against to find the closest exit zone
Результат UnityEngine.GameObject

ClosestShelf() публичный Метод

Gets the closest shelf to the given pposition that stocks the given product. Returns null if no shelf stocks the given product
public ClosestShelf ( Vector3 position, string product ) : Shelf
position UnityEngine.Vector3 The position to check against when finding the closest shelf
product string The product that the shelf must stock in order to be considered for closeness
Результат Shelf

Deposit() публичный Метод

Adds the given amount of money to the supermarkets cash pool
public Deposit ( float amount ) : void
amount float The amount of money to add to this supermarket's cash pool
Результат void

NextEmptyShelf() публичный Метод

public NextEmptyShelf ( ) : Shelf
Результат Shelf

NotifyDeposit() публичный Метод

public NotifyDeposit ( float amountDeposited ) : void
amountDeposited float
Результат void

NotifyShelfEmpty() публичный Метод

Interface method. Called when a shelf runs out of the given product.
public NotifyShelfEmpty ( Shelf shelf, string product ) : void
shelf Shelf The shelf that has run out of stock of a product
product string The product that the shelf has run out of the given product
Результат void

NotifyWithdrawal() публичный Метод

public NotifyWithdrawal ( float amountWithdrawn ) : void
amountWithdrawn float
Результат void

OccupiedCheckout() публичный Метод

public OccupiedCheckout ( ) : Checkout
Результат Checkout

RandomCheckout() публичный Метод

Selects a random checkout in this supermarket.
public RandomCheckout ( ) : Checkout
Результат Checkout

RandomExit() публичный Метод

Gets a random exit zone.
public RandomExit ( ) : GameObject
Результат UnityEngine.GameObject

RandomPosition() публичный Метод

Gets a random position within the supermarket that is on the supermarket navmesh
public RandomPosition ( ) : Vector3
Результат UnityEngine.Vector3

RandomProduct() публичный Метод

Gets a random product with a random quantity from the supermarket catalogue
public RandomProduct ( ) : Product
Результат Product

RemoveListener() публичный Метод

public RemoveListener ( IWalletListener listener ) : void
listener IWalletListener
Результат void

Withdraw() публичный Метод

Withdraws the given amount of money from the supermarket's cash pool
public Withdraw ( float amount ) : void
amount float The amount of money to withdraw
Результат void

Описание свойств

ExitIcon публичное свойство

public GameObject,UnityEngine ExitIcon
Результат UnityEngine.GameObject

IdleIcon публичное свойство

public GameObject,UnityEngine IdleIcon
Результат UnityEngine.GameObject

WanderIcon публичное свойство

public GameObject,UnityEngine WanderIcon
Результат UnityEngine.GameObject