> For the complete documentation index, see [llms.txt](https://cowsins-ai.gitbook.io/cowsins-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsins-ai.gitbook.io/cowsins-ai/easy-navigation-in-cowsins-ai/cowsinsai.cs.md).

# CowsinsAI.cs

### 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](/cowsins-ai/getting-started/tutorials.md) 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](/cowsins-ai/easy-navigation-in-cowsins-ai/waypoints.cs.md) 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cowsins-ai.gitbook.io/cowsins-ai/easy-navigation-in-cowsins-ai/cowsinsai.cs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
