NitinBan55
New member
Hi. We want our custom script to respond to a change in state. Like for example we have created a custom script and inherited it from StateBehavior, and created our custom preset which simply sets a boolean value to true, when the Aim state is active.
Now the problem is that when the Player aims, rest of the scripts that inherit StateBehavior like CameraController and others, set the Aim state active and the values are set respectively. But it doesn't work in our case.
Here's a screenshot for reference.
.
(Basically the Combat Started bool should set to true when the Aim state is active)
This is the Preset Setting:
Here's the script:
public class GameManager : StateBehavior
{
[SerializeField] private bool combatStarted;
public bool CombatStarted { get { return combatStarted; } set { combatStarted = value ; } }
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
When we manually activate the state, then it works perfectly.
(The Combat Started boolean is set to true as soon as Aim State is active, and is set to false again when Aim in no more active)
We want this to work automatically based upon state change (in this case when Player Aims).
Now the problem is that when the Player aims, rest of the scripts that inherit StateBehavior like CameraController and others, set the Aim state active and the values are set respectively. But it doesn't work in our case.
Here's a screenshot for reference.
.
(Basically the Combat Started bool should set to true when the Aim state is active)
This is the Preset Setting:
Here's the script:
public class GameManager : StateBehavior
{
[SerializeField] private bool combatStarted;
public bool CombatStarted { get { return combatStarted; } set { combatStarted = value ; } }
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
When we manually activate the state, then it works perfectly.
(The Combat Started boolean is set to true as soon as Aim State is active, and is set to false again when Aim in no more active)
We want this to work automatically based upon state change (in this case when Player Aims).