void CInput::OnHardwareMouseEvent(int iX,int iY,EHARDWAREMOUSEEVENT eHardwareMouseEvent, int wheelDelta) { IMonoArray *pParams = CreateMonoArray(4); pParams->Insert(iX); pParams->Insert(iY); pParams->Insert(eHardwareMouseEvent); pParams->Insert(wheelDelta); GetClass()->InvokeArray(NULL, "OnMouseEvent", pParams); SAFE_RELEASE(pParams); }
bool CInput::OnInputEvent(const SInputEvent &event) { IMonoArray *pParams = CreateMonoArray(2); pParams->Insert(event.keyName.c_str()); pParams->Insert(event.value); GetClass()->InvokeArray(NULL, "OnKeyEvent", pParams); SAFE_RELEASE(pParams); return false; }
bool CInput::OnActionTriggered(EntityId entityId, const ActionId& actionId, int activationMode, float value) { IMonoArray *pParams = CreateMonoArray(3); pParams->Insert(actionId.c_str()); pParams->Insert(activationMode); pParams->Insert(value); GetClass()->InvokeArray(NULL, "OnActionTriggered", pParams); SAFE_RELEASE(pParams); return false; }
void CScriptbind_Input::OnHardwareMouseEvent(int iX,int iY,EHARDWAREMOUSEEVENT eHardwareMouseEvent, int wheelDelta) { IMonoArray *pParams = CreateMonoArray(4); pParams->Insert(iX); pParams->Insert(iY); pParams->Insert(eHardwareMouseEvent); pParams->Insert(wheelDelta); IMonoClass *pInputClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Input", "CryEngine"); pInputClass->GetMethod("OnMouseEvent", 4)->InvokeArray(NULL, pParams); SAFE_RELEASE(pParams); }
bool CScriptbind_Input::OnInputEvent(const SInputEvent &event) { IMonoArray *pParams = CreateMonoArray(2); pParams->Insert(event.keyName.c_str()); pParams->Insert(event.value); IMonoClass *pInputClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Input", "CryEngine"); pInputClass->GetMethod("OnKeyEvent", 2)->InvokeArray(NULL, pParams); SAFE_RELEASE(pParams); return false; }
IMPLEMENT_RMI(CMonoActor, ClScriptRMI) { IMonoClass *pActorClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Entity"); IMonoArray *pNetworkArgs = CreateMonoArray(3); pNetworkArgs->Insert(ToMonoString(params.methodName.c_str())); pNetworkArgs->Insert(params.pArgs); pNetworkArgs->Insert(params.targetId); pActorClass->InvokeArray(nullptr, "OnRemoteInvocation", pNetworkArgs); return true; }
bool CScriptbind_Input::OnActionTriggered(EntityId entityId, const ActionId& actionId, int activationMode, float value) { IMonoArray *pParams = CreateMonoArray(3); pParams->Insert(actionId.c_str()); pParams->Insert(activationMode); pParams->Insert(value); IMonoClass *pInputClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Input", "CryEngine"); pInputClass->GetMethod("OnActionTriggered", 3)->InvokeArray(NULL, pParams); SAFE_RELEASE(pParams); return false; }
IMPLEMENT_RMI(CMonoEntityExtension, SvScriptRMI) { IMonoClass *pEntityClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Entity"); IMonoArray *pNetworkArgs = CreateMonoArray(3); pNetworkArgs->Insert(ToMonoString(params.methodName.c_str())); pNetworkArgs->InsertMonoObject(params.args); pNetworkArgs->Insert(params.targetId); pEntityClass->InvokeArray(nullptr, "OnRemoteInvocation", pNetworkArgs); pNetworkArgs->Release(); return true; }
void CScriptSystem::OnPostUpdate(float fDeltaTime) { FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SCRIPT, gEnv->bProfilerEnabled); IMonoArray *pArgs = CreateMonoArray(5); pArgs->Insert(fDeltaTime); pArgs->Insert(gEnv->pTimer->GetFrameStartTime().GetMilliSeconds()); pArgs->Insert(gEnv->pTimer->GetAsyncTime().GetMilliSeconds()); pArgs->Insert(gEnv->pTimer->GetFrameRate()); pArgs->Insert(gEnv->pTimer->GetTimeScale()); // Updates all scripts and sets Time.FrameTime. m_pScriptManager->CallMethod("OnUpdate", fDeltaTime, gEnv->pTimer->GetFrameStartTime().GetMilliSeconds(), gEnv->pTimer->GetAsyncTime().GetMilliSeconds(), gEnv->pTimer->GetFrameRate(), gEnv->pTimer->GetTimeScale()); }
mono::object CScriptbind_Entity::GetEntitiesByClass(mono::string _class) { IEntityClass *pDesiredClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ToCryString(_class)); std::vector<EntityId> classEntities; IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator(); pIt->MoveFirst(); while(!pIt->IsEnd()) { if(IEntity *pEntity = pIt->Next()) { if(pEntity->GetClass() == pDesiredClass) classEntities.push_back(pEntity->GetId()); } } if(classEntities.size()<1) return nullptr; IMonoClass *pEntityIdClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("EntityId"); IMonoArray *pArray = CreateMonoArray(classEntities.size()); for(auto it = classEntities.begin(); it != classEntities.end(); ++it) pArray->Insert(pEntityIdClass->BoxObject(&mono::entityId(*it))); return pArray->GetManagedObject(); }
void CScriptbind_Console::OnMonoCmd(IConsoleCmdArgs *cmdArgs) { IMonoArray *pArgs = CreateMonoArray(1); pArgs->Insert(cmdArgs->GetCommandLine()); g_pScriptSystem->GetCryBraryAssembly()->GetClass("ConsoleCommand")->InvokeArray(NULL, "OnCommand", pArgs); }
CMonoFlowNode::~CMonoFlowNode() { IMonoClass *pFlowNodeClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("FlowNode", "CryEngine.Flowgraph"); IMonoArray *pParams = CreateMonoArray(1); pParams->Insert(m_scriptId); pFlowNodeClass->InvokeArray(nullptr, "InternalRemove", pParams); }
void CCryScriptInstance::OnReloadComplete() { if(m_scriptId == 0) return; IMonoObject *pScriptManager = g_pScriptSystem->GetScriptManager(); IMonoArray *pArgs = CreateMonoArray(2); pArgs->Insert(m_scriptId); pArgs->Insert(m_flags); if(mono::object result = pScriptManager->GetClass()->InvokeArray(pScriptManager->GetManagedObject(), "GetScriptInstanceById", pArgs)) { SetManagedObject((MonoObject *)result, true); } else MonoWarning("Failed to locate script instance %i after reload!", m_scriptId); pArgs->Release(); }
ICryScriptInstance *CScriptSystem::InstantiateScript(const char *scriptName, EMonoScriptFlags scriptFlags, IMonoArray *pConstructorParameters, bool throwOnFail) { FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SCRIPT, gEnv->bProfilerEnabled); auto *pInstance = new CCryScriptInstance(scriptFlags); IMonoArray *pScriptCreationArgs = CreateMonoArray(5); pScriptCreationArgs->Insert(scriptName); pScriptCreationArgs->Insert(scriptFlags); pScriptCreationArgs->InsertNativePointer(pInstance); pScriptCreationArgs->InsertMonoObject((pConstructorParameters != nullptr ? pConstructorParameters->GetManagedObject() : nullptr)); pScriptCreationArgs->Insert(throwOnFail); auto result = m_pScriptManager->GetClass()->GetMethod("CreateScriptInstance", 5)->InvokeArray(m_pScriptManager->GetManagedObject(), pScriptCreationArgs); SAFE_RELEASE(pScriptCreationArgs); if(!result) return nullptr; pInstance->SetManagedObject((MonoObject *)result, true); if(scriptFlags & eScriptFlag_GameRules) { IMonoClass *pGameRulesInitParamsClass = m_pCryBraryAssembly->GetClass("GameRulesInitializationParams"); IMonoArray *pArgs = CreateMonoArray(1); SGameRulesInitializationParams params; pArgs->InsertMonoObject(pGameRulesInitParamsClass->BoxObject(¶ms)); InitializeScriptInstance(pInstance, pArgs); SAFE_RELEASE(pArgs); } for each(auto listener in m_listeners) listener->OnScriptInstanceCreated(scriptName, scriptFlags, pInstance); return pInstance; }
IMonoAssembly *CScriptDomain::LoadAssembly(const char *file, bool shadowCopy, bool convertPdbToMdb) { const char *path; if(shadowCopy) path = GetTempPath().append(PathUtil::GetFile(file)); else path = file; for each(auto assembly in m_assemblies) { if(!strcmp(path, assembly->GetPath())) return assembly; } if(shadowCopy) CopyFile(file, path, false); string sAssemblyPath(path); #ifndef _RELEASE if(g_pMonoCVars->mono_generateMdbIfPdbIsPresent != 0 && convertPdbToMdb && sAssemblyPath.find("pdb2mdb")==-1) { if (IMonoAssembly *pDebugDatabaseCreator = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetDebugDatabaseCreator()) { if(IMonoClass *pDriverClass = pDebugDatabaseCreator->GetClass("Driver", "")) { if(IMonoMethod *pConvertMethod = pDriverClass->GetMethod("Convert", 1)) { IMonoArray *pArgs = CreateMonoArray(1); pArgs->Insert(path); pConvertMethod->InvokeArray(nullptr, pArgs); SAFE_RELEASE(pArgs); } } } } #endif if(MonoAssembly *pMonoAssembly = mono_domain_assembly_open(m_pDomain, path)) { CScriptAssembly *pAssembly = new CScriptAssembly(this, mono_assembly_get_image(pMonoAssembly), path); m_assemblies.push_back(pAssembly); return pAssembly; } return nullptr; }
bool CScriptbind_Entity::OnRemove(IEntity *pIEntity) { if(IMonoClass *pEntityClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("Entity")) { IMonoArray *pArgs = CreateMonoArray(1); pArgs->Insert(pIEntity->GetId()); auto result = pEntityClass->InvokeArray(NULL, "InternalRemove", pArgs)->Unbox<bool>(); SAFE_RELEASE(pArgs); if(!result) return false; } return true; }
bool CScriptbind_Entity::OnRemove(IEntity *pIEntity) { if(m_pEntityClass == nullptr) return true; IMonoArray *pArgs = CreateMonoArray(1); pArgs->Insert(pIEntity->GetId()); IMonoObject *pResult = *m_pEntityClass->GetMethod("InternalRemove", 1)->InvokeArray(NULL, pArgs); auto result = pResult->Unbox<bool>(); SAFE_RELEASE(pArgs); SAFE_RELEASE(pResult); return result; return true; }
mono::object CScriptbind_Entity::GetEntitiesInBox(AABB bbox, int objTypes) { IPhysicalEntity **pEnts = nullptr; IMonoClass *pEntityIdClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("EntityId"); int numEnts = gEnv->pPhysicalWorld->GetEntitiesInBox(bbox.min, bbox.max, pEnts, objTypes); if(numEnts > 0) { IMonoArray *pEntities = CreateMonoArray(numEnts); for(int i = 0; i < numEnts; i++) pEntities->Insert(pEntityIdClass->BoxObject(&mono::entityId(gEnv->pPhysicalWorld->GetPhysicalEntityId(pEnts[i])))); return pEntities->GetManagedObject(); } return nullptr; }
IMonoAssembly *CScriptDomain::LoadAssembly(const char *file, bool shadowCopy, bool convertPdbToMdb) { const char *path; if(shadowCopy) path = GetTempPath().append(PathUtil::GetFile(file)); else path = file; for each(auto assembly in m_assemblies) { if(!strcmp(path, assembly->GetPath())) return assembly; } if(shadowCopy) CopyFile(file, path, false); string sAssemblyPath(path); #ifndef _RELEASE if(convertPdbToMdb && sAssemblyPath.find("pdb2mdb")==-1) { if(IMonoAssembly *pDebugDatabaseCreator = g_pScriptSystem->GetDebugDatabaseCreator()) { if(IMonoClass *pDriverClass = pDebugDatabaseCreator->GetClass("Driver", "")) { IMonoArray *pArgs = CreateMonoArray(1); pArgs->Insert(path); pDriverClass->InvokeArray(NULL, "Convert", pArgs); SAFE_RELEASE(pArgs); } } } #endif MonoAssembly *pMonoAssembly = mono_domain_assembly_open(m_pDomain, path); CRY_ASSERT(pMonoAssembly); CScriptAssembly *pAssembly = new CScriptAssembly(this, mono_assembly_get_image(pMonoAssembly), path); m_assemblies.push_back(pAssembly); return pAssembly; }
mono::object CScriptbind_Entity::QueryProximity(AABB box, mono::string className, uint32 nEntityFlags) { SEntityProximityQuery query; if(className != nullptr) query.pEntityClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ToCryString(className)); query.box = box; query.nEntityFlags = nEntityFlags; gEnv->pEntitySystem->QueryProximity(query); IMonoClass *pEntityIdClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("EntityId"); if(query.nCount > 0) { IMonoArray *pEntities = CreateMonoArray(query.nCount); for(int i = 0; i < query.nCount; i++) pEntities->Insert(pEntityIdClass->BoxObject(&mono::entityId(query.pEntities[i]->GetId()))); return pEntities->GetManagedObject(); } return nullptr; }
bool CMonoActor::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags ) { if (aspect == eEA_Physics) { pe_type type = PE_NONE; switch (profile) { case eAP_NotPhysicalized: type = PE_NONE; break; case eAP_Spectator: type = PE_LIVING; break; case eAP_Alive: type = PE_LIVING; break; case eAP_Sleep: type = PE_ARTICULATED; break; case eAP_Frozen: type = PE_RIGID; break; case eAP_Ragdoll: type = PE_ARTICULATED; break; case eAP_Linked: //if actor is attached to a vehicle - don't serialize actor physics additionally return true; break; default: return false; } // TODO: remove this when craig fixes it in the network system if (profile==eAP_Spectator) { int x=0; ser.Value("unused", x, 'skip'); } else if (profile==eAP_Sleep) { int x=0; ser.Value("unused1", x, 'skip'); ser.Value("unused2", x, 'skip'); } if (type == PE_NONE) return true; IEntityPhysicalProxy * pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS); if (ser.IsWriting()) { if (!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type) { gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot( ser, type, 0 ); return true; } } else if (!pEPP) { return false; } // PLAYERPREDICTION if(type!=PE_LIVING) { pEPP->SerializeTyped( ser, type, pflags ); } // ~PLAYERPREDICTION } ser.BeginGroup("ManagedActor"); IMonoArray *pArgs = CreateMonoArray(4); pArgs->InsertNativePointer(&ser); pArgs->Insert(aspect); pArgs->Insert(profile); pArgs->Insert(pflags); m_pScript->GetClass()->InvokeArray(m_pScript, "InternalNetSerialize", pArgs); ser.EndGroup(); return true; }
void CMonoFlowNode::ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo) { m_pActInfo = pActInfo; if(m_pHookedGraph && m_pScript != nullptr) { m_pHookedGraph->UnregisterHook(this); m_pHookedGraph = nullptr; } switch(event) { case eFE_Activate: { IFlowNodeData *pNodeData = pActInfo->pGraph->GetNodeData(pActInfo->myID); if(!pNodeData) return; int numInputPorts = pNodeData->GetNumInputPorts(); if(m_flags & EFLN_TARGET_ENTITY) numInputPorts--; // last input is the entity port. for(int i = 0; i < numInputPorts; i++) { if(IsPortActive(i)) { switch(GetPortType(pActInfo, i)) { case eFDT_Void: m_pScript->CallMethod("OnPortActivated", i); break; case eFDT_Int: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortInt(pActInfo, i)); break; case eFDT_Float: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortFloat(pActInfo, i)); break; case eFDT_EntityId: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortEntityId(pActInfo, i)); break; case eFDT_Vec3: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortVec3(pActInfo, i)); break; case eFDT_String: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortString(pActInfo, i)); break; case eFDT_Bool: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortBool(pActInfo, i)); break; default: break; } } } } break; case eFE_Initialize: m_pScript->CallMethod("OnInit"); break; case eFE_SetEntityId: { if(pActInfo->pEntity) { IMonoArray *pParams = CreateMonoArray(2); pParams->InsertNativePointer(pActInfo->pEntity); pParams->Insert(pActInfo->pEntity->GetId()); m_pScript->GetClass()->GetMethod("InternalSetTargetEntity", 2)->InvokeArray(m_pScript->GetManagedObject(), pParams); pParams->Release(); } } break; case eFE_Update: m_pScript->CallMethod("OnNodeUpdate"); break; } }
bool CScriptSystem::Reload() { if((!m_bFirstReload && g_pMonoCVars->mono_realtimeScripting == 0) || m_bReloading) return false; m_bReloading = true; if(!m_bFirstReload) { for each(auto listener in m_listeners) listener->OnReloadStart(); m_pScriptManager->CallMethod("Serialize"); } IMonoDomain *pScriptDomain = CreateDomain("ScriptDomain", nullptr, true); IMonoAssembly *pCryBraryAssembly = pScriptDomain->LoadAssembly(PathUtils::GetBinaryPath() + "CryBrary.dll"); IMonoArray *pCtorParams = CreateMonoArray(2); pCtorParams->InsertAny(m_bFirstReload); pCtorParams->InsertMonoString(ToMonoString(PathUtils::GetConfigPath())); IMonoObject *pScriptManager = *pCryBraryAssembly->GetClass("ScriptManager", "CryEngine.Initialization")->CreateInstance(pCtorParams); SAFE_RELEASE(pCtorParams); auto result = pScriptManager->CallMethod("Initialize", m_bFirstReload); if(result == nullptr) return false; IMonoObject *pResult = *result; auto reloadResult = pResult->Unbox<EScriptReloadResult>(); SAFE_RELEASE(pResult); switch(reloadResult) { case EScriptReloadResult_Success: { // revert previous domain if(!m_bFirstReload) m_pScriptDomain->Release(); m_pScriptDomain = pScriptDomain; m_pScriptManager = pScriptManager; m_pCryBraryAssembly = pCryBraryAssembly; CacheManagedResources(); if(!m_bFirstReload) m_pScriptManager->CallMethod("Deserialize"); // Set Network.Editor etc. IMonoClass *pClass = m_pCryBraryAssembly->GetClass("Game"); IMonoArray *pArgs = CreateMonoArray(2); pArgs->Insert(gEnv->IsEditor()); pArgs->Insert(gEnv->IsDedicated()); pClass->GetMethod("InitializeGameStatics", 2)->InvokeArray(nullptr, pArgs); SAFE_RELEASE(pArgs); m_pScriptManager->CallMethod("ProcessWaitingScripts", m_bFirstReload); for each(auto listener in m_listeners) listener->OnReloadComplete(); if(!m_bFirstReload && gEnv->IsEditor()) gEnv->pFlowSystem->ReloadAllNodeTypes(); m_bReloading = false; m_bDetectedChanges = false; return true; } break; case EScriptReloadResult_Retry: { m_bReloading = false; return Reload(); } case EScriptReloadResult_Revert: { pScriptDomain->Release(); m_pScriptDomain->SetActive(); m_bReloading = false; m_bDetectedChanges = false; return false; } break; case EScriptReloadResult_Abort: { gEnv->pSystem->Quit(); m_bReloading = false; } break; } return false; }
void CEntityEventHandler::HandleEntityEvent(EEntityType type, SEntityEvent &event, IEntity *pEntity, mono::object managedObject) { switch(event.event) { case ENTITY_EVENT_RESET: { bool enterGamemode = event.nParam[0]==1; if(!enterGamemode && pEntity->GetFlags() & ENTITY_FLAG_NO_SAVE) { gEnv->pEntitySystem->RemoveEntity(pEntity->GetId()); return; } IMonoArray *pParams = CreateMonoArray(1); pParams->Insert(enterGamemode); m_pClass[type]->GetMethod("OnEditorReset", 1)->InvokeArray(managedObject, pParams); SAFE_RELEASE(pParams); } break; case ENTITY_EVENT_COLLISION: { EventPhysCollision *pCollision = (EventPhysCollision *)event.nParam[0]; SMonoColliderInfo source = SMonoColliderInfo(pCollision, 0); SMonoColliderInfo target = SMonoColliderInfo(pCollision, 1); IMonoClass *pColliderInfoClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("ColliderInfo"); IMonoArray *pArgs = CreateMonoArray(6); pArgs->InsertMonoObject(pColliderInfoClass->BoxObject(&source)); pArgs->InsertMonoObject(pColliderInfoClass->BoxObject(&target)); pArgs->Insert(pCollision->pt); pArgs->Insert(pCollision->n); pArgs->Insert(pCollision->penetration); pArgs->Insert(pCollision->radius); m_pClass[type]->GetMethod("OnCollision", 6)->InvokeArray(managedObject, pArgs); SAFE_RELEASE(pArgs); } break; case ENTITY_EVENT_START_GAME: m_pClass[type]->GetMethod("OnStartGame")->Invoke(managedObject); break; case ENTITY_EVENT_START_LEVEL: m_pClass[type]->GetMethod("OnStartLevel")->Invoke(managedObject); break; case ENTITY_EVENT_LEVEL_LOADED: m_pClass[type]->GetMethod("OnLevelLoaded")->Invoke(managedObject); break; case ENTITY_EVENT_ENTERAREA: m_pClass[type]->GetMethod("OnEnterArea", 3)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2]); break; case ENTITY_EVENT_MOVEINSIDEAREA: m_pClass[type]->GetMethod("OnMoveInsideArea", 3)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2]); break; case ENTITY_EVENT_LEAVEAREA: m_pClass[type]->GetMethod("OnLeaveArea", 3)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2]); break; case ENTITY_EVENT_ENTERNEARAREA: m_pClass[type]->GetMethod("OnEnterNearArea", 3)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2]); break; case ENTITY_EVENT_MOVENEARAREA: m_pClass[type]->GetMethod("OnMoveNearArea", 4)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2], event.fParam[0]); break; case ENTITY_EVENT_LEAVENEARAREA: m_pClass[type]->GetMethod("OnLeaveNearArea", 3)->Call(managedObject, (EntityId)event.nParam[0], (int)event.nParam[1], (EntityId)event.nParam[2]); break; case ENTITY_EVENT_XFORM: m_pClass[type]->GetMethod("OnMove", 1)->Call(managedObject, (EEntityXFormFlags)event.nParam[0]); break; case ENTITY_EVENT_ATTACH: m_pClass[type]->GetMethod("OnAttach", 1)->Call(managedObject, (EntityId)event.nParam[0]); break; case ENTITY_EVENT_DETACH: m_pClass[type]->GetMethod("OnDetach", 1)->Call(managedObject, (EntityId)event.nParam[0]); break; case ENTITY_EVENT_DETACH_THIS: m_pClass[type]->GetMethod("OnDetachThis", 1)->Call(managedObject, (EntityId)event.nParam[0]); break; case ENTITY_EVENT_ANIM_EVENT: { const AnimEventInstance* pAnimEvent = reinterpret_cast<const AnimEventInstance*>(event.nParam[0]); ICharacterInstance* pCharacter = reinterpret_cast<ICharacterInstance*>(event.nParam[1]); IMonoClass *pAnimationEventClass = g_pScriptSystem->GetCryBraryAssembly()->GetClass("AnimationEvent"); SMonoAnimationEvent animEvent(pAnimEvent); IMonoArray *pArgs = CreateMonoArray(1); pArgs->InsertMonoObject(pAnimationEventClass->BoxObject(&animEvent)); m_pClass[type]->GetMethod("OnAnimEvent", 1)->InvokeArray(managedObject, pArgs); SAFE_RELEASE(pArgs); } break; case ENTITY_EVENT_PREPHYSICSUPDATE: { m_pClass[type]->GetMethod("OnPrePhysicsUpdate")->Invoke(managedObject); } break; } }