Merge pull request #279 from SHADE-DP/SP3-6-c-scripting

Added support for enabling and disabling components from scripts
This commit is contained in:
XiaoQiDigipen 2022-11-25 13:06:40 +08:00 committed by GitHub
commit d9c8296aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

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

View File

@ -36,7 +36,7 @@ namespace SHADE
/// </summary> /// </summary>
property GameObject Owner property GameObject Owner
{ {
GameObject get() { return owner; } GameObject get();
} }
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
@ -166,6 +166,19 @@ namespace SHADE
template<typename NativeType> template<typename NativeType>
public ref class Component : public BaseComponent 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: internal:
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Type Definitions */ /* Type Definitions */