-
Notifications
You must be signed in to change notification settings - Fork 7
Game Kit Controller Integration
This tutorial will get Emerald AI working with Game Kit Controller (GKC). This will allow users to use GKC to damage, both ranged and melee, Emerald AI agents as well as have Emerald AI damage the GKC player. Note: This tutorial requires adding a few lines to a couple GKC scripts and some basic understanding of minor editing of scripts.
In order for Emerald AI to work correctly, your scenes must be baked with Unity’s NavMesh. For a quick guide on how to do so, see Unity’s guide here: Baking your Scene with Unity's NavMesh. Your AI’s attack animations will also need to have Attack Animation Events for ranged/melee attacks. See the tutorial on doing this here: Attack Animation Event Tutorial
(Important: There’s an additional step below to add melee damage support that is not covered in the tutorial video) This code should be placed right under the last if statement within the applyDamage script in the checkHealth function.
EmeraldAI.EmeraldAISystem EmeraldAIToCheck = objectToDamage.GetComponent<EmeraldAI.EmeraldAISystem>();
if (EmeraldAIToCheck)
{
EmeraldAIToCheck.Damage((int)damageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player);
}
This code should be placed right above return false; within the applyDamage script in the checkCanBeDamage function.
EmeraldAI.EmeraldAISystem EmeraldAIToCheck = objectToDamage.GetComponent<EmeraldAI.EmeraldAISystem>();
if (EmeraldAIToCheck)
{
EmeraldAIToCheck.Damage((int)damageAmount, EmeraldAI.EmeraldAISystem.TargetType.Player);
}
This function should be placed within the EmeraldAIPlayerDamage. Make sure it is called with DamageGameKitController(DamageAmount); in the SendPlayerDamage function.
//Damage the Game Kit Controller system
void DamageGameKitController (int DamageAmount)
{
if (GetComponent<health>() != null)
{
GetComponent<health>().setDamage((float)DamageAmount, Vector3.forward, this.transform.position, this.gameObject, this.gameObject, true, false, false, false, true, false, 0, 0);
}
}
This concludes the GKC integration tutorial, if something isn’t working correctly, repeat the steps to ensure nothing was missed. Ensure that you have applied an Animation Event to your AI’s attack animations. If you’re having issues with implementing GKC, and you’ve gone through the tutorial, support can be provided at: Support@BlackHorizonStudios.com
- Version 3.0 Upgrade Guide
- Creating an AI through the Setup Manager
- Setting up an AI's Animations
- Creating Attack Animation Events
- Creating an AI Ability Object
- Applying an AI's Head Transform
- Applying an AI's Ranged Attack Transform
- Setting up an AI's Factions
- Setting up an AI's Layers and Tags
- Using the Combat Text System
- Setting up an AI's Optimization Settings
- Setting up an AI with Ragdoll Deaths
- Creating a Shooter AI
- Creating a Floating or Hovering AI
- Using Emerald AI's Built in Object Pool
- Using the Emerald AI Needs System
- Using Emerald AI with Crux Spawner
- Using Location Based Damage
- Using the Emerald AI Camera Shake System
- Setting up an Equippable and Unequippable Weapon
- Setting up Ranged Weapon Hand IK
- Using the Target Position Modifier
- Using the Built-in IK System
- Setting up Non-AI Targets
- Setting up Custom Damage with Emerald AI
- Using the Sound Detector System
- Setting up the Built in Health Bars and Name Text
- Behaviors and Confidence Levels
- Wander Types and Movement
- Using Factions and Faction Manager
- Detection Type and Target Picking
- Adjusting an AI Hit's Transform
- Enabling an AI's Debugging Tools