unity3d invector expand fsm controller
C#
using UnityEngine;
namespace Invector.vCharacterController.AI
{
/// <summary>
/// This is a simple example on how to expand the AI Controller by creating your own methods, you don't need to modify the core scripts
/// Simple expand the Interface and the Controller here, and you can create new FSM Custom Actions & Decitions to call your custom methods
/// </summary>
// First create a Partial Interface vIControlAI to expand access to the FSM with new methods and variables
public partial interface vIControlAI
{
// Here we created a variable that can be access from my New Action
GameObject customTarget { get; }
bool _moveToTarget { get; }
// Declaring the new Method that will be implemented below
void MoveToTargetExample();
}
// Now create a Partial class vControlAI and implement the new methods and variables from our Interface above
public partial class vControlAI
{
// The vEditorToolbar will display a new tab in your AI Controller Inspector
[vEditorToolbar("Custom Properties")]
// This variable will appear in the new Tab 'Custom Properties'
[vHelpBox("Check the script 'vControlAI_ExpandExample' to see how you can expand the controller by creating your own methods and variables", vHelpBoxAttribute.MessageType.Info)]
public GameObject myTarget;
// Just a bool so we can test the method, check true via inspector to make the controller MoveTo the target assigned
public bool moveToTarget;
// We need to create the bool again so we can pass this information to the FSM
public bool _moveToTarget { get => moveToTarget; }
// This is a simple example for the FSM to have access to the variable myTarget
public GameObject customTarget { get => myTarget; }
// Make it public so you can call it when you create a new FSM CustomAction
// To create a new FSM CustomAction open the FSM Window > FSM Component click on the '+' button > Action > New Action Script
// Then simple call your method in the DoAction like this:
// fsmBehaviour.aiController.MyNewMethod();
public void MoveToTargetExample()
{
// Simple example to move the controller to a specific position set via inspector
if(myTarget != null)
{
// Here we simple call the method MoveTo from the original vControlAI script
MoveTo(myTarget.transform.position);
Debug.Log("Controller Calling 'MoveTo' ");
}
else
{
Debug.Log("Controller Calling 'MoveTo' but a 'myTarget' is not assigned");
}
}
}
}
Also in C#:
- Title
- unity oncollisionenter
- Category
- C#
- Title
- c# clear console read chache
- Category
- C#
- Title
- C# save pdf stream to file
- Category
- C#
- Title
- c# check internet connection easy
- Category
- C#
- Title
- c# convert to nullable datetime
- Category
- C#
- Title
- c# clear list items
- Category
- C#
- Title
- ecs get specific entities with component
- Category
- C#
- Title
- office open xml check if row is empty
- Category
- C#
- Title
- what does thismean incsharp public static void Main
- Category
- C#
- Title
- c# create array of int
- Category
- C#
- Title
- c# inline if
- Category
- C#
- Title
- c sharp check if list contains
- Category
- C#
- Title
- How to look at an object unity
- Category
- C#
- Title
- epplus excel vb.net
- Category
- C#
- Title
- unity gizmo draw line
- Category
- C#
- Title
- c# double value with 2 decimal places
- Category
- C#
- Title
- unity 2d platformer movement script c#
- Category
- C#
- Title
- c# using get set methods
- Category
- C#
- Title
- linq in c#
- Category
- C#
- Title
- no overload for 'useItemOnSceneLoad' matches delegate 'UnityAction<Scene, LoadSceneMode>'
- Category
- C#
- Title
- autoresetevent
- Category
- C#
- Title
- c# long to int
- Category
- C#
- Title
- convert number of days into months c#
- Category
- C#
- Title
- how to make rb.addforce 2d
- Category
- C#
- Title
- unity find object by name
- Category
- C#
- Title
- c# make request to rest api
- Category
- C#
- Title
- what function is called just before the a script is ended c#
- Category
- C#
- Title
- unity transfoprm position y change
- Category
- C#
- Title
- how to change scenes in unity
- Category
- C#
- Title
- convert string array to int C#
- Category
- C#
- Title
- rotatearound unity
- Category
- C#
- Title
- how to hide a panel ui unity
- Category
- C#
- Title
- c# webrequest cookies
- Category
- C#
- Title
- c# remove last value from list
- Category
- C#
- Title
- center an image horizontally and vertically
- Category
- C#
- Title
- check if string is email c#
- Category
- C#
- Title
- unity how to change the text on a button
- Category
- C#
- Title
- interpolate rotation unity3d
- Category
- C#
- Title
- c# yield
- Category
- C#
- Title
- c# getasync response
- Category
- C#
- Title
- drag object unity 2d
- Category
- C#
- Title
- array copy c#
- Category
- C#
- Title
- how to set progress openedge driver name for odbc connection c#
- Category
- C#
- Title
- isprime c#
- Category
- C#
- Title
- input get button uibutton
- Category
- C#
- Title
- how to detected WindowCloseEvent in other window wpf
- Category
- C#
- Title
- socket in c#
- Category
- C#
- Title
- perlin noise unity
- Category
- C#
- Title
- can't add an editor script
- Category
- C#
- Title
- new command - latex
- Category
- C#
- Title
- unitt only 1 number float
- Category
- C#
- Title
- response redirect new tab
- Category
- C#
- Title
- c# dictionary literal initializer
- Category
- C#
- Title
- how to declare 2d array in c#
- Category
- C#
- Title
- c# how to take from a float
- Category
- C#
- Title
- c# get list of all class fields
- Category
- C#
- Title
- initialize matrix c#
- Category
- C#
- Title
- get user directory of file in c#
- Category
- C#
- Title
- eager loading vs lazy loading c#
- Category
- C#
- Title
- unity 2d enemy field of view
- Category
- C#
- Title
- unity get scrollbar value
- Category
- C#
- Title
- c# add to array
- Category
- C#
- Title
- c# scene manager
- Category
- C#
- Title
- .net core convert keycollection to array
- Category
- C#
- Title
- c# stringbuilder
- Category
- C#
- Title
- how to delay something in c# unity
- Category
- C#
- Title
- load information with txt file to uwp c#
- Category
- C#
- Title
- c# new dictionary linq
- Category
- C#
- Title
- add row count devepxress report
- Category
- C#
- Title
- computer
- Category
- C#
- Title
- c# convert Unix time in seconds to datetime
- Category
- C#
- Title
- how to close a windows form application in c#
- Category
- C#
- Title
- c# timespan
- Category
- C#
- Title
- wpf restart application c#
- Category
- C#
- Title
- unity how to add a bullet impact force
- Category
- C#
- Title
- c# linq to select even numbers
- Category
- C#
- Title
- c# download file
- Category
- C#
- Title
- newtonsoft create dynamic object
- Category
- C#
- Title
- add spaces between words unity
- Category
- C#
- Title
- c# length of array
- Category
- C#
- Title
- check if network is available c#
- Category
- C#
- Title
- what is using static in c#
- Category
- C#
- Title
- how to convert iformfile to byte array c#
- Category
- C#
- Title
- instantiate object in circle
- Category
- C#
- Title
- ping with c#
- Category
- C#
- Title
- c sharp string replace
- Category
- C#
- Title
- how to parse a string to an integer c#
- Category
- C#
- Title
- print gridcontrol devexpress
- Category
- C#
- Title
- how to record number of times using application in c#
- Category
- C#
- Title
- c# stop loop
- Category
- C#
- Title
- c# print
- Category
- C#
- Title
- c# reverse string
- Category
- C#
- Title
- mailkit send attachment
- Category
- C#
- Title
- dynamically add rows to datagridview c#
- Category
- C#
- Title
- invalidoperationexception c# ui thread
- Category
- C#
- Title
- unity up arrow input
- Category
- C#
- Title
- c# convert byte to char
- Category
- C#
- Title
- c# find element by condition
- Category
- C#
- Title
- sum of digits in c#
- Category
- C#
- Title
- unity c# get bool from another script
- Category
- C#