Cowsins AI
  • Before We Start
    • Introduction & License Agreement
    • Before Getting Started
  • Getting Started
    • How To Install
    • Tutorials
  • Easy Navigation in Cowsins AI
    • Content
    • CowsinsAI.cs
    • EnemyAI.cs
    • Waypoints.cs
  • Unity Toolbar
    • Cowsins AI Setup Handler
    • Cowsins AI Animator Controller Creator
  • AI Setup
    • Old Setup
    • New (Simple) Setup
  • Misc
    • FAQ
Powered by GitBook
On this page
  • Basic Variables
  • Combat Variables
  • Debug Variables
  1. Easy Navigation in Cowsins AI

CowsinsAI.cs

You can find this script in Assets > CowsinsAI > Scripts

Basic Variables

  • Current State - This is a read only enumerator which defines what state the AI is currently in (Idle, Search, Attack)

  • AI Type - This defines how the AI will function (Enemy, NPC)

  • Use Ragdoll - This allows the AI to ragdoll upon death view Tutorials to see how to set this up

If 'Use Ragdoll' is set to false, these variables will show:

-- Start --

  • Use Death Animation - Will search for the 'Death' boolean in the Animator to trigger the animation upon death instead of using ragdoll

  • Destroy After Time - A float will appear where you can set how long in seconds until the AI destroys itself to save performance

-- End --

  • Dumb AI - This will make the AI act as sort of a dummy that you can shoot at and kill without it attacking you or moving

if 'Dumb AI' is set to false, these variables will show:

  • Move Mode - Several options to choose from (Random Move, Waypoints, Idle)

    Random

    • Wander Radius - How far out the AI will go in one movement

    • Min Wander Distance - Minimum distance the AI should move from where the its' previous position was

    • Max Wander Distance - Maximum distance the AI should move from where its' previous position was

    • Wait Time Between Wander - After time has elapsed, it will move to a different position (Adjust this variable to fit your preference)

    Waypoints

    • Waypoints - This requires an empty gameObject in the scene with the Waypoints.cs script attached that has different locations predefined.

    • Waypoint Wait Time - After time has elapsed, it will move to the next waypoint in the list (Adjust this variable to fit your preference)

    Idle

    • No variables

  • Search Radius - How far out the AI should search for the AI whilst in the 'Search' state

  • Increase Sight on Attack - When enabled, the viewing angle for the AI will increase after provoked by player and in 'Search' state

  • Attack Search Angle - Defines what radius the AI can see after being provoked by the player in the 'Search' state

  • Search Angle - Defines what radius the AI can see

  • Target Mask - The layer that the AI will use as the player's layer (hostile)

  • Obstruction Mask - The layer(s) that the AI can not see the player through

  • Search Wait Time - How long the AI will spend trying to find the player after losing sight

Combat Variables

  • Enemy Type - Gives you two options to choose from for the enemy AI: Shooter, Melee

    Shooter

    • Type - Gives you two options to choose from as the enemy type: Hitscan, Projectile

      Hitscan

      • Bullet Trail - The GameObject with a line renderer that the AI will use

      • Spread Amount - The amount of spread the AI will use whilst firing so it won't laser you

      • Hit Mask - The layer that the AI will use to damage the player

      Projectile

      • Projectile - The GameObject the AI will use to spawn and damage the player

      Universal Combat Variables

      • Fire Point - The empty gameObject that the AI will use to fire the bullets from

      • Shooter Animator - The Animator the AI will use for the shooter animations

      • Shoot Distance - The distance of which the AI will stop at to start shooting at the player

      • In Shooting Distance - Boolean used for debugging to see if the AI is in an appropriate radius

      • Time Between Shots - Seconds elapsed before the next shot is fired

    Melee

    • Melee Distance - How close to the player the AI will get before attacking

    • Melee Animator - The Animator the AI will use for the melee animations

    • Wait Between Attack - Seconds elapsed before the next attack occurs

  • Damage Amount - How much the AI will damage the player for

Debug Variables

  • Shooting Distance Debug - When enabled and with 'gizmos' selected, you can visualize the radius used for shooting attacks

  • Melee Distance Debug - When enabled and with 'gizmos' selected, you can visualize the radius used for melee attacks

  • Can See Player Debug - When enabled and with 'gizmos' selected, you can see if the AI can see the player by a line being drawn between the AI and the player

  • Search Radius Debug - When enabled and with 'gizmos' selected, you can visualize the radius used for search

Runtime Debug Variables

  • Can See Player - Boolean used if the AI can see the player

PreviousContentNextEnemyAI.cs

Last updated 1 year ago