Skip to content
ldstrumpet edited this page Feb 23, 2015 · 18 revisions

#Controller API

##Data Controllers These controllers receive calls from Unity (clicks, keys, etc) and react by making necessary changes to the Model. Together, these classes should contain access to all Models.

####Data Management Controller

class DataManagementController
{
    CharacterController character;
    TimeController time;
}

####Scene Model Controller Handles character collision with scene borders (changing scenes or outer boundaries).

class SceneModelController
{
    SceneModel model;

    // Loads new Scene into model based on location when hitting collider
    void OnCollisionWithBorder(Transform);
}

####Character Controller Handles character Model changes including inventory and meters

class CharacterController
{
    CharacterModel model;

    // Passes these actions on to model
    void OnHour();
    void TakeDamage();
    double getDamage();
    
    void UseItem(); // tells InventoryController to use an item
    bool HasOnHand(Item); // checks for a specific Item in hand
}

####Time Controller Handles changes in time and has a list of ITimeAffected Controllers to call every hour

class TimeManagementController
{
    // These include Character Controller
    List<ITimeAffected> listeners; 
    
    // This value will change depending as the character moves or acts
    double time;  

    // value when the above variable "time" incurs the OnHour function 
    double const TIME_PER_HOUR;
    
    // Calls OnHour() for all listeners
    void OnHour();
    void AddTime(double);
}

####Interaction Controller Handles 'E' key press calls by checking area (colliders) for Interactable Environments (storage, trees, water, etc).

class InteractionController
{    
    // Checks for colliders in Transform area to interact with
    void OnEKey(Transform);
}

####NPC Controller Handles interaction between character and NPCs

####Inventory Controller Handles interaction between character and NPCs

##View Controllers These controllers listen for changes in the Model and react by informing Unity of necessary changes to the View.

https://www.lucidchart.com/publicSegments/view/54eb8e87-7e14-4d81-a949-18ed0a009bd7

####Character Movement Controller Handles changes to character position

####NPC Movement Controller Handles npc movement when not interacting with character

####Meter View Controller Shows changes to the meters from the Model in Unity

####Inventory View Controller Handles opening/closing inventory gui.

Clone this wiki locally