I'm making a 2D game with custom controls and I know about adding new behaviors in the game controls menu to allow me to do this. I was wondering if there is a way to make it so my speed variables in my custom script can be controlled by adjusting the speed settings in the ORK framework editor?
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Ok cool. Well I tried accessing the combatant component and couldn't get it to find it. I think I have everything set up right in my code. Does my script need to be in a special folder or something? Sorry, I'm an artist that dabbles in scripting from time to time. Plus I normally use Javascript and am trying to move over to C#.
Anyway, this is my code that I plugged in to behaviours for game movement for testing.
using ORKFramework; using UnityEngine; using System.Collections;
namespace ORKFramework.Behaviours { public class PlayerControlSprites : MonoBehaviour { private Combatant combatant = null;
Check your combatant's game object if there even is a CombatantComponent attached to it ...
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Just gave it a try with your code and it's working for me (I get the console spammed with 'Found').
It doesn't matter if the component is already added to the prefab or added by ORK (through custom control behaviours). Also, it works with and without the namespace, and when it's compiled within the DLL or as an additional script in Unity - all versions work for me ...
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Alright, got speed and everything working with the ORK framework editor. Started a new project and worked fine. Must have messed something up while experimenting late at night. heh
You can get the combatant through the CombatantComponent, which attached to every combatant in your scene. There's a helper class to easily get it:
Combatant combatant = ComponentHelper.GetCombatant(this.gameObject);
After that, you can access the combatant's speed through:
float speed = combatant.GetMoveSpeed(MoveSpeedType.Run);
Edit: moved to scripting.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Anyway, this is my code that I plugged in to behaviours for game movement for testing.
using ORKFramework;
using UnityEngine;
using System.Collections;
namespace ORKFramework.Behaviours
{
public class PlayerControlSprites : MonoBehaviour
{
private Combatant combatant = null;
void Start ()
{
combatant = ComponentHelper.GetCombatant(this.gameObject);
}
void Update ()
{
if (combatant != null)
{
Debug.Log("Found");
}
else
{
Debug.Log("Null");
combatant = ComponentHelper.GetCombatant(this.gameObject);
}
}
}
}
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
It doesn't matter if the component is already added to the prefab or added by ORK (through custom control behaviours). Also, it works with and without the namespace, and when it's compiled within the DLL or as an additional script in Unity - all versions work for me ...
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Thanks for the help!