C# Class Supermarket.Supermarket

Supermarket script. Contains product catalogue and directory information, manages shelves, and money.
Inheritance: UnityEngine.MonoBehaviour, IEmptyShelfListener
Show file Open project: Clarksj4/Theme-Supermarket-Tycoon-World Class Usage Examples

Public Properties

Property Type Description
ExitIcon UnityEngine.GameObject
IdleIcon UnityEngine.GameObject
WanderIcon UnityEngine.GameObject

Public Methods

Method Description
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

Method Details

AddListener() public method

public AddListener ( IWalletListener listener ) : void
listener IWalletListener
return void

AddToDirectory() public method

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
return void

Awake() public method

public Awake ( ) : void
return void

ClosestExit() public method

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
return UnityEngine.GameObject

ClosestShelf() public method

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
return Shelf

Deposit() public method

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
return void

NextEmptyShelf() public method

public NextEmptyShelf ( ) : Shelf
return Shelf

NotifyDeposit() public method

public NotifyDeposit ( float amountDeposited ) : void
amountDeposited float
return void

NotifyShelfEmpty() public method

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
return void

NotifyWithdrawal() public method

public NotifyWithdrawal ( float amountWithdrawn ) : void
amountWithdrawn float
return void

OccupiedCheckout() public method

public OccupiedCheckout ( ) : Checkout
return Checkout

RandomCheckout() public method

Selects a random checkout in this supermarket.
public RandomCheckout ( ) : Checkout
return Checkout

RandomExit() public method

Gets a random exit zone.
public RandomExit ( ) : GameObject
return UnityEngine.GameObject

RandomPosition() public method

Gets a random position within the supermarket that is on the supermarket navmesh
public RandomPosition ( ) : Vector3
return UnityEngine.Vector3

RandomProduct() public method

Gets a random product with a random quantity from the supermarket catalogue
public RandomProduct ( ) : Product
return Product

RemoveListener() public method

public RemoveListener ( IWalletListener listener ) : void
listener IWalletListener
return void

Withdraw() public method

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
return void

Property Details

ExitIcon public property

public GameObject,UnityEngine ExitIcon
return UnityEngine.GameObject

IdleIcon public property

public GameObject,UnityEngine IdleIcon
return UnityEngine.GameObject

WanderIcon public property

public GameObject,UnityEngine WanderIcon
return UnityEngine.GameObject