Customizing The System - IsaacMulcahy/RPG-AI-SYSTEM-WIKI GitHub Wiki

Animation Controller

The animation controller is used to animate the NPC within the scene.

To Replace

Required Parameters

  • Moving : Boolean
  • Dynamic : Boolean

Required Animation

  • Dynamic

References

  • AIController - animator.SetBool("Moving", moving);
  • AIController - animator.SetBool("Dynamic", dynamic);

Chat System

The system allows for pausing of NPC's while they are at work, this is done by using the 'AIDataBoard' 'SetPaused' function. This system pauses the timer and the LookAt data for the current action and will reapply it after the 'Pause' is cancelled. The function takes two parameters, 'pause' and 'newLookAt'. Pause is the new state, newLookAt is where the NPC will look during the pause. The recommended approach is to have a script attached the the NPC prefab which when the player interacts with the NPC will call the 'SetPaused' function and then fire off the chat system you wish to use. After this is done then the chat system can make the same function call to resume their work.

Game Manager / Timing

The Game Manager is a simple service which is used for the time of day and the passage of time. The time is 0-2400 and has to stay within this range to keep it in keeping with the requirements set in the Flowchart Editor. It updates by 'Time.deltaTime' each update call

To Replace

Required Functions

  • getTime() : return float;

References

  • AIDataboard has a static reference to the GameManager - Set by search in Awake()
  • Civil Manager has a Reference which is used on AIDataBoard.setupCharacter() function Editor
  • AIManager loads one from Resources when using Auto Setup scene (System/Objects/Game Manager)
  • TimeWindow has a static reference to the gameManager

Item System

The Item system is used to allow the project to identify objects within the scene. This uses currently ITEMS (An enum for names) as well as the Item class

To Replace

Item

Required Functions

  • IsInUse : Boolean
  • SetInUse(bool update) : Boolean

References

Action Node

  • ItemNeeded
  • ItemOutput
AI Databoard
  • currentGoalObj
  • getGoalItem()
  • setGoalItem()
Actions
  • Locate()
  • LocateOwned()
  • LocateRandomOwned()
  • LocateItemInZone()
  • PickUp()
  • Mount()
Looking Mutations
  • GetWorkplaceObjects()
  • GetItems()

Flowchart Connection

  • RequirementGeneral

Requirement Widget (Editor)

  • RequirementGeneral

Action Node (Editor)

  • Action()
  • Item Needed
  • Item Output

Nav Mesh Agent

The navmesh agent is set to work through an interface system. For reference on setup you can follow 'UnityNavMeshAgent' which is how the basic Unity System is implemented.

  1. Create a new class which inherits from 'INavMeshAgent'
  2. Add an entry to NAV_MODE' enum
  3. Within 'SettingsLoader' function 'LoadNavMeshAgent' add to the switch statement for the new type. This should create an object of the class which inherits from 'INavMeshAgent'
  4. Set the new mode in the Overview manager