NPC Activation
Last updated
Was this helpful?
Last updated
Was this helpful?
The NPCActivation Script Component can be added to any gameObject where the visibility is dependent on a Key,Value pair of data stored in the userChoice dictionary. The key and valid values for visualization are configured in the inspector. In the case of RobotState, the Robot's visibility in the Store, Forrest, and EndScene require that key: RobotState has value: companion. It that key-value pair does not exist in the dictionary, then the gameObject has SetActive( false ).
The image above shows that the key: RobotState must have value of companion.
NPCActivation: For a given key, there can be a list of possible values, such that if any of these values exist in the dictionary for the given key, then the gameObject will be visible in the scene.
We can execute either ActivateNPC( ) or DeactivateNPC( ) using a UI button if we want the robot disappears to disappear when the Button with SaveChoice is Executed
This occurs in the BeginScene when the ChoiceButton, with thescript attached: as configured below: Selling the Robot: saves: key: RobotState, value: parts,