Added support for enabling and disabling components from scripts #279

Merged
Pycorax merged 1 commits from SP3-6-c-scripting into main 2022-11-25 13:06:40 +08:00
2 changed files with 22 additions and 1 deletions
Showing only changes of commit 73d0486fc8 - Show all commits

View File

@ -22,6 +22,14 @@ of DigiPen Institute of Technology is prohibited.
namespace SHADE
{
/*---------------------------------------------------------------------------------*/
/* Properties */
/*---------------------------------------------------------------------------------*/
GameObject BaseComponent::Owner::get()
{
return owner;
}
/*---------------------------------------------------------------------------------*/
/* Component Access Functions */
/*---------------------------------------------------------------------------------*/

View File

@ -36,7 +36,7 @@ namespace SHADE
/// </summary>
property GameObject Owner
{
GameObject get() { return owner; }
GameObject get();
}
/*-----------------------------------------------------------------------------*/
@ -166,6 +166,19 @@ namespace SHADE
template<typename NativeType>
public ref class Component : public BaseComponent
{
public:
/*-----------------------------------------------------------------------------*/
/* Properties */
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Whether or not the Component is active and being updated by the engine.
/// </summary>
property bool Enabled
{
bool get() { return GetNativeComponent()->isActive; }
void set(bool value) { GetNativeComponent()->isActive = value; }
}
internal:
/*-----------------------------------------------------------------------------*/
/* Type Definitions */