static int _m_AddMonster(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityMMO.MonsterMgr gen_to_be_invoked = (UnityMMO.MonsterMgr)translator.FastGetCSObj(L, 1); { long _uid = LuaAPI.lua_toint64(L, 2); long _typeID = LuaAPI.lua_toint64(L, 3); UnityEngine.Vector3 _pos; translator.Get(L, 4, out _pos); UnityEngine.Vector3 _targetPos; translator.Get(L, 5, out _targetPos); float _curHp = (float)LuaAPI.lua_tonumber(L, 6); float _maxHp = (float)LuaAPI.lua_tonumber(L, 7); Unity.Entities.Entity gen_ret = gen_to_be_invoked.AddMonster(_uid, _typeID, _pos, _targetPos, _curHp, _maxHp); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_AddMainRole(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityMMO.SceneMgr gen_to_be_invoked = (UnityMMO.SceneMgr)translator.FastGetCSObj(L, 1); { long _uid = LuaAPI.lua_toint64(L, 2); long _typeID = LuaAPI.lua_toint64(L, 3); string _name = LuaAPI.lua_tostring(L, 4); int _career = LuaAPI.xlua_tointeger(L, 5); UnityEngine.Vector3 _pos; translator.Get(L, 6, out _pos); float _curHp = (float)LuaAPI.lua_tonumber(L, 7); float _maxHp = (float)LuaAPI.lua_tonumber(L, 8); Unity.Entities.Entity gen_ret = gen_to_be_invoked.AddMainRole(_uid, _typeID, _name, _career, _pos, _curHp, _maxHp); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_AddSceneObject(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityMMO.SceneMgr gen_to_be_invoked = (UnityMMO.SceneMgr)translator.FastGetCSObj(L, 1); { long _uid = LuaAPI.lua_toint64(L, 2); string _content = LuaAPI.lua_tostring(L, 3); Unity.Entities.Entity gen_ret = gen_to_be_invoked.AddSceneObject(_uid, _content); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void OnResetAuth(WorkerSystem worker, Entity entity, ref TransformInternal.Component transformComponent, Rigidbody rigidbody) { rigidbody.MovePosition(transformComponent.Location.ToUnityVector() + worker.Origin); rigidbody.MoveRotation(transformComponent.Rotation.ToUnityQuaternion()); rigidbody.AddForce(transformComponent.Velocity.ToUnityVector() - rigidbody.velocity, ForceMode.VelocityChange); }
static int _m_AddMainRole(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityMMO.SceneMgr gen_to_be_invoked = (UnityMMO.SceneMgr)translator.FastGetCSObj(L, 1); { long _uid = LuaAPI.lua_toint64(L, 2); UnityEngine.Vector3 _pos; translator.Get(L, 3, out _pos); Unity.Entities.Entity gen_ret = gen_to_be_invoked.AddMainRole(_uid, _pos); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public MonoBehaviourActivationManager(GameObject gameObject, RequiredFieldInjector injector, InjectableStore store, ILogDispatcher logger) { this.logger = logger; this.store = store; this.injector = injector; var spatialComponent = gameObject.GetComponent <SpatialOSComponent>(); var workerType = spatialComponent.Worker.WorkerType; entity = spatialComponent.Entity; foreach (var behaviour in gameObject.GetComponents <MonoBehaviour>()) { if (ReferenceEquals(behaviour, null)) { continue; } var behaviourType = behaviour.GetType(); if (injector.IsSpatialOSBehaviour(behaviourType)) { var componentReadRequirements = injector.GetComponentPresenceRequirements(behaviourType); var componentAuthRequirements = injector.GetComponentAuthorityRequirements(behaviourType); var workerTypeRequirements = injector.GetComponentWorkerTypeRequirementsForBehaviours(behaviourType); if (workerTypeRequirements != null && !workerTypeRequirements.Contains(workerType)) { // This behaviour does not want to be enabled for this worker. RunWithExceptionHandling(() => behaviour.enabled = false); continue; } var readRequirementCount = componentReadRequirements.Count; var authRequirementCount = componentAuthRequirements.Count; // This is the case when a MonoBehaviour only requires CommandRequestSenders. if (readRequirementCount == 0 && authRequirementCount == 0) { behavioursToEnable.Add(behaviour); } if (readRequirementCount > 0) { AddBehaviourForComponentIds(behaviour, componentReadRequirements, behavioursRequiringComponentsPresent); } if (authRequirementCount > 0) { AddBehaviourForComponentIds(behaviour, componentAuthRequirements, behavioursRequiringComponentsWithAuth); } numUnsatisfiedRequirements[behaviour] = componentReadRequirements.Count + componentAuthRequirements.Count; RunWithExceptionHandling(() => behaviour.enabled = false); } } }
internal ReceivedResponse(DeleteEntityResponseOp op, Entity sendingEntity, Request req, long requestId) { SendingEntity = sendingEntity; StatusCode = op.StatusCode; Message = op.Message; EntityId = new EntityId(op.EntityId); RequestPayload = req; Context = req.Context; RequestId = requestId; }
protected override void OnUpdate(Entity targetEntity, UnitVisualBackend backend, UnitVisualAnimation animation) { var currAnim = animation.CurrAnimation; var abilityEntity = AbilityFinder.GetAbility(backend.DstEntity); EntityManager.TryGetComponentData <AbilityState>(abilityEntity, out var abilityState); if (abilityEntity == default || (abilityState.Phase & EAbilityPhase.HeroActivation) == 0) { if (currAnim.Type == SystemType) { animation.SetTargetAnimation(new TargetAnimation(default, previousType: currAnim.Type));
internal ReceivedResponse(CreateEntityResponseOp op, Entity sendingEntity, Request req, long requestId) { SendingEntity = sendingEntity; StatusCode = op.StatusCode; Message = op.Message; RequestPayload = req; Context = req.Context; RequestId = requestId; EntityId = op.EntityId.HasValue ? new EntityId(op.EntityId.Value) : (EntityId?)null; }
internal ReceivedResponse(ReserveEntityIdsResponseOp op, Entity sendingEntity, Request req, long requestId) { SendingEntity = sendingEntity; StatusCode = op.StatusCode; Message = op.Message; NumberOfEntityIds = op.NumberOfEntityIds; RequestPayload = req; Context = req.Context; RequestId = requestId; FirstEntityId = op.FirstEntityId.HasValue ? new EntityId(op.FirstEntityId.Value) : (EntityId?)null; }
public ReceivedResponse( Unity.Entities.Entity sendingEntity, EntityId entityId, string message, StatusCode statusCode, global::Improbable.Common.Empty?response, global::Improbable.Gdk.Health.HealthModifier request, System.Object context, long requestId) { SendingEntity = sendingEntity; EntityId = entityId; Message = message; StatusCode = statusCode; ResponsePayload = response; RequestPayload = request; Context = context; RequestId = requestId; }
public ReceivedResponse( Unity.Entities.Entity sendingEntity, EntityId entityId, string message, StatusCode statusCode, global::Improbable.TestSchema.SomeType?response, global::Improbable.TestSchema.SomeType request, global::System.Object context, long requestId) { SendingEntity = sendingEntity; EntityId = entityId; Message = message; StatusCode = statusCode; ResponsePayload = response; RequestPayload = request; Context = context; RequestId = requestId; }
public ReceivedResponse( Unity.Entities.Entity sendingEntity, EntityId entityId, string message, StatusCode statusCode, global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty?response, global::Improbable.Gdk.Tests.ComponentsWithNoFields.Empty request, global::System.Object context, long requestId) { SendingEntity = sendingEntity; EntityId = entityId; Message = message; StatusCode = statusCode; ResponsePayload = response; RequestPayload = request; Context = context; RequestId = requestId; }
public ReceivedResponse( Unity.Entities.Entity sendingEntity, EntityId entityId, string message, StatusCode statusCode, global::Improbable.Gdk.Tests.BlittableTypes.SecondCommandResponse?response, global::Improbable.Gdk.Tests.BlittableTypes.SecondCommandRequest request, System.Object context, long requestId) { SendingEntity = sendingEntity; EntityId = entityId; Message = message; StatusCode = statusCode; ResponsePayload = response; RequestPayload = request; Context = context; RequestId = requestId; }
public ReceivedResponse( Unity.Entities.Entity sendingEntity, EntityId entityId, string message, StatusCode statusCode, global::Improbable.Gdk.PlayerLifecycle.CreatePlayerResponse?response, global::Improbable.Gdk.PlayerLifecycle.CreatePlayerRequest request, global::System.Object context, CommandRequestId requestId) { SendingEntity = sendingEntity; EntityId = entityId; Message = message; StatusCode = statusCode; ResponsePayload = response; RequestPayload = request; Context = context; RequestId = requestId; }
public MonoBehaviourActivationManager(GameObject gameObject, RequiredFieldInjector injector, InjectableStore store, ILogDispatcher logger) { this.logger = logger; this.store = store; this.injector = injector; var spatialComponent = gameObject.GetComponent <SpatialOSComponent>(); entity = spatialComponent.Entity; spatialId = spatialComponent.SpatialEntityId; foreach (var behaviour in gameObject.GetComponents <MonoBehaviour>()) { var behaviourType = behaviour.GetType(); if (injector.HasRequiredFields(behaviourType)) { var componentReadRequirements = injector.GetComponentPresenceRequirements(behaviourType); var componentAuthRequirements = injector.GetComponentAuthorityRequirements(behaviourType); var readRequirementCount = componentReadRequirements.Count; var authRequirementCount = componentAuthRequirements.Count; if (readRequirementCount == 0 && authRequirementCount == 0) { behavioursToEnable.Add(behaviour); } if (readRequirementCount > 0) { AddBehaviourForComponentIds(behaviour, componentReadRequirements, behavioursRequiringComponentsPresent); } if (authRequirementCount > 0) { AddBehaviourForComponentIds(behaviour, componentAuthRequirements, behavioursRequiringComponentsWithAuth); } numUnsatisfiedRequirements[behaviour] = componentReadRequirements.Count + componentAuthRequirements.Count; behaviour.enabled = false; } } }
public VoxelHitData(Unity.Physics.RaycastHit _hit, Unity.Entities.Entity _entity) { rayInfo = _hit; hitTransform = GameMaster.Instance.entitiesToObjectMap[_entity]; component = hitTransform.GetComponent <VoxelComponent>(); if (component == null) { return; } voxelObject = component.voxelObject; _hit.Position += (_hit.SurfaceNormal * 0.1f); // Pad the ray to penetrate into the voxel's space worldNormal = _hit.SurfaceNormal; worldNormal.Normalize(); localNormal = hitTransform.InverseTransformDirection(_hit.SurfaceNormal); localNormal.Normalize(); voxelPosition = hitTransform.InverseTransformPoint(_hit.Position); voxelPosition -= (component.pivotPoint + (Vector3.one * 0.5f)); // Offset to match voxel coordinates voxelPosition.x = (float)Math.Round(voxelPosition.x); voxelPosition.y = (float)Math.Round(voxelPosition.y); voxelPosition.z = (float)Math.Round(voxelPosition.z); voxelPosition -= localNormal; // Reverse centering localPosition = voxelPosition + component.pivotPoint + (Vector3.one * 0.5f); worldPosition = hitTransform.position + (hitTransform.rotation * localPosition); localFacePosition = (localPosition + localNormal); voxelFacePosition = (voxelPosition + localNormal); worldFacePosition = (worldPosition + worldNormal); atHit = Coord3D.fromVector3(voxelPosition); // The coord of the voxel that was hit atFace = Coord3D.fromVector3(voxelFacePosition); // The coord of the voxel at the face that was hit }
static int _m_AddToEntityManager_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { Unity.Entities.EntityManager _entityManager = (Unity.Entities.EntityManager)translator.GetObject(L, 1, typeof(Unity.Entities.EntityManager)); UnityEngine.GameObject _gameObject = (UnityEngine.GameObject)translator.GetObject(L, 2, typeof(UnityEngine.GameObject)); Unity.Entities.Entity gen_ret = Unity.Entities.GameObjectEntity.AddToEntityManager(_entityManager, _gameObject); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
internal ReceivedResponse(EntityQueryResponseOp op, Entity sendingEntity, Request req, long requestId) { SendingEntity = sendingEntity; StatusCode = op.StatusCode; Message = op.Message; ResultCount = op.ResultCount; RequestPayload = req; Context = req.Context; RequestId = requestId; if (op.Result == null) { Result = null; return; } Result = new Dictionary <EntityId, EntitySnapshot>(); foreach (var entityIdToEntity in op.Result) { Result.Add(new EntityId(entityIdToEntity.Key), new EntitySnapshot(entityIdToEntity.Value)); } }
public CommandRequestId SendCommand <TRequest>(TRequest request, Entity sendingEntity = default) where TRequest : ICommandRequest { connectionHandler.OnSendCommand(nextRequestId, typeof(TRequest), request); return(new CommandRequestId(nextRequestId++)); }