Hello!
This might be a simple question/answer but within the Dialogue System Events under Conversation Start/End, can I toggle my "Can Move - True/False" under a Player Controller script component?
Initially I have the Player Controller.enabled off, and Player Animator.enabled off, and Player Rigidbody2D.sleep to stop the player from moving and animating while in a conversation. This turns off those entire components and stops my player from running and animating but he freezes mid run and stays on that frame.
Is there a simpler way to set my 'Can Move' from true to false under the Player Controller script (my player goes to zero velocity and his animation returns to a facing state instead of immediately stopping him mid run) within the Dialogue System Events?
Just somewhere I can put this in 'PlayerController.instance.canMove = false;'
Thanks again for any help! I am loving the whole Dialogue System overall!
Dialogue System Events - Can I toggle a setting within a component?
- foxfoxwaltz
- Posts: 5
- Joined: Mon Aug 02, 2021 1:17 am
Re: Dialogue System Events - Can I toggle a setting within a component?
Hi,
Yes, you can use Dialogue System Events, or add OnConversationStart/OnConversationEnd() methods to your PlayerController script. Make sure the player GameObject is being used as the conversation actor. See Character GameObject Assignments for details. Briefly: Assign the player GameObject to the Dialogue System Trigger's Conversation Actor field, or add a Dialogue Actor component to the Player GameObject and select the Player actor.
If you use Dialogue System Events, you may be able to select PlayerController.canMove from the UnityEvent's inspector. Otherwise you may need to use OnConversationStart/End() methods. You could add them to a new script on the player or add them to your PlayerController script. Example:
Yes, you can use Dialogue System Events, or add OnConversationStart/OnConversationEnd() methods to your PlayerController script. Make sure the player GameObject is being used as the conversation actor. See Character GameObject Assignments for details. Briefly: Assign the player GameObject to the Dialogue System Trigger's Conversation Actor field, or add a Dialogue Actor component to the Player GameObject and select the Player actor.
If you use Dialogue System Events, you may be able to select PlayerController.canMove from the UnityEvent's inspector. Otherwise you may need to use OnConversationStart/End() methods. You could add them to a new script on the player or add them to your PlayerController script. Example:
Code: Select all
void OnConversationStart(Transform actor)
{
PlayerController.instance.canMove = false;
}
void OnConversationEnd(Transform actor)
{
PlayerController.instance.canMove = true;
}
- foxfoxwaltz
- Posts: 5
- Joined: Mon Aug 02, 2021 1:17 am
Re: Dialogue System Events - Can I toggle a setting within a component?
Thank you so much!
This was exactly what I needed and very easy to implement.
I appreciate your time and quick reply!
This was exactly what I needed and very easy to implement.
I appreciate your time and quick reply!