public RadiusSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(ImpactRadius) })); World.Get <RulesSystem>().AddHandler <ImpactEvent>(this); }
public UnityParticleSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(HitParticlesComponent), typeof(ParticleTrailComponent), })); }
public static void DebugStatus(int entity) { DebugStatus(EntityController.GetEntity(entity)); }
public static void RegisterToEntity(Collider collider, int entId) { EntityController.Get(entId).Tags.Set(EntityTags.CanUnityCollide, 1); _colliderToDictionary.AddOrUpdate(collider, entId); }
public PhysicsSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(PhysicsOnDamageComponent) })); }
public TransformSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new [] { typeof(DisableTrOnDeath) })); }
public DirectionalSpriteSystem() { NodeFilter <DirectionalSpriteNode> .Setup(DirectionalSpriteNode.GetTypes()); _directionalComponents = EntityController.GetNodeList <DirectionalSpriteNode>(); }
public CachedStat(int entity, string statId) { _entityId = entity; _statId = statId; _stat = EntityController.Get(_entityId)?.Get <StatsContainer>()?.Get <T>(_statId); }
public CollisionCheckSystem() { NodeFilter <CollisionCheckForwardNode> .Setup(CollisionCheckForwardNode.GetTypes()); _list = EntityController.GetNodeList <CollisionCheckForwardNode>(); }
private void OnGUI() { if (!Application.isPlaying) { Close(); return; } if (_inPointStyle == null || _nodeStyle == null || _nodeTextStyle == null) { SetupStyles(); } var list = EntityController.GetComponentArray <AnimationGraphComponent>(); _entityListing.Clear(); _smallerList.Clear(); int currentIndex = -1; foreach (var graphComponent in list) { if (graphComponent == _graph) { currentIndex = _entityListing.Count; } _entityListing.Add(graphComponent.GetEntity().DebugId); _smallerList.Add(graphComponent); } var newIndex = EditorGUILayout.Popup(currentIndex, _entityListing.ToArray()); if (newIndex != currentIndex) { _graph = _smallerList[newIndex]; } _scrollRect = new Rect(0, 0, position.width - Border, position.height); _scrollPosition = GUI.BeginScrollView(_scrollRect, _scrollPosition, new Rect(0, 0, MaxRectSize, MaxRectSize)); DrawGrid(20, 0.2f, Color.gray); DrawGrid(100, 0.4f, Color.gray); if (_graph == null) { EditorGUILayout.LabelField("No Graph Selected of " + _entityListing.Count); GUI.EndScrollView(); return; } if (_graph.Value == null) { EditorGUILayout.LabelField("Component has no Graph " + _graph.GetEntity()?.DebugId ?? "None"); GUI.EndScrollView(); return; } if (_graph.Value.Current is ExternalGraphNode.RuntimeNode externalGraphNode) { DrawGraph(externalGraphNode.ExternalGraph); } else if (_graph.Value.Current is SwitchExternalNode.RuntimeNode switchGraphNode) { DrawGraph(switchGraphNode.ExternalGraph); } else { DrawGraph(_graph.Value); } }
public ActionFxSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(ActionFxComponent), typeof(SpawnPrefabOnDeath), })); }
public CollisionEventSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(DespawnOnCollision) })); }
public void Handle(ActionStateEvent arg) { if (arg.State == ActionStateEvents.Start) { Triggered = false; } else if (arg.State == ActionStateEvents.Impact && !Triggered) { Triggered = true; World.Get <RadiusSystem>().HandleRadius(EntityController.GetEntity(arg.Origin), EntityController.GetEntity(arg.Focus), Radius); } }
public void OnPeriodicUpdate() { if (_visibleNodes == null) { _visibleNodes = EntityController.GetNodeList <UnitOccupyingCellNode>(); } if (_sensorList == null) { _sensorList = EntityController.GetNodeList <SensorDetectingNode>(); } if (_visibleNodes == null || _sensorList == null || !Game.GameActive || Game.Paused) { return; } var ls = World.Get <LineOfSightSystem>(); for (int n = 0; n < _sensorList.Count; n++) { var node = _sensorList[n]; var sensor = node.Sensor.c; sensor.DetectedCells.Clear(); var start = node.Position.c.Position; sensor.LastDetectedCenter = start; var fwd = node.Entity.Tr.ForwardDirection2D(); for (int i = 0; i < DirectionsExtensions.Length2D; i++) { var dir = (Directions)i; var maxRowDistance = dir == fwd ? sensor.MaxVisionDistance : sensor.MaxHearDistance; var adjacent = dir.Adjacent(); ShadowFloodFill.CheckRow(ref sensor.DetectedCells, start, start, maxRowDistance, new[] { adjacent[0].ToPoint3(), adjacent[1].ToPoint3() }, dir.ToPoint3()); } for (int i = 0; i < _visibleNodes.Count; i++) { var visible = _visibleNodes[i]; if (visible.Entity == node.Entity) { continue; } if (!sensor.DetectedCells.Contains(visible.Position.c)) { continue; } var isVision = true; if (CheckVision) { ls.CanSeeOrHear(node.Entity, visible.Entity, out isVision); } sensor.AddWatch(visible.Entity, isVision); } for (int w = sensor.WatchTargets.Count - 1; w >= 0; w--) { if (sensor.WatchTargets[w].Target == null) { sensor.RemoveWatch(sensor.WatchTargets[w]); continue; } sensor.WatchTargets[w].LastSensedTurnCount++; if (sensor.WatchTargets[w].LastSensedTurnCount > MaxTurnsNpcVisible) { sensor.RemoveWatch(sensor.WatchTargets[w]); } } } }
public StateGraphSystem() { _animationGraphComponents = EntityController.GetComponentArray <AnimationGraphComponent>(); _animationDel = UpdateGraphComponent; }
public InventorySystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(InventoryItem) })); }
public StatusUpdateSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(StatusUpdateComponent), typeof(FloatingTextStatusComponent), typeof(FloatingTextCombatComponent), })); }
public FlightPhysicsSystem() { NodeFilter <FlyingNode> .Setup(FlyingNode.GetTypes()); _flyingList = EntityController.GetNodeList <FlyingNode>(); }
public SpawnSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(DespawnTimer) })); }
private static CollisionEvent?CheckRayList(Entity originEntity, Ray ray, int limit, bool limitEnemy) { for (int i = 0; i < limit; i++) { if (originEntity.IsDestroyed()) { return(null); } var hit = _rayHits[i]; Entity hitEntity = EntityController.GetEntity(UnityToEntityBridge.GetEntityId(hit.collider)); bool isEnvironment = hitEntity == null && hit.transform.IsEnvironment(); #if DEBUG_RAYCAST Color pointColor = Color.white; if (isEnvironment) { pointColor = Color.green; } else if (hit.transform.CompareTag(StringConst.TagInvalidCollider)) { pointColor = Color.magenta; } else if (hitEntity != null) { pointColor = Color.red; } DebugExtension.DrawPoint(_rayHits[i].point + (Vector3.up * (i * 0.1f)), pointColor, 0.25f, 2.5f); #endif if (isEnvironment) { #if DEBUG DebugLog.Add(originEntity.DebugId + " hit environment " + _rayHits[i].transform.name); #endif originEntity.Post(new EnvironmentCollisionEvent(originEntity, _rayHits[i].point, _rayHits[i].normal)); return(null); } if (hitEntity == null) { continue; } if (IsValidCollision(originEntity, limitEnemy, hitEntity, _rayHits[i].collider, out var sourceNode, out var targetNode)) { if (targetNode.DetailCollider != null) { var detailTr = targetNode.DetailCollider.Collider.transform; var localPoint = hit.transform.InverseTransformPoint(ray.origin); var localDir = hit.transform.InverseTransformDirection(ray.direction); var rayCast = new Ray(detailTr.TransformPoint(localPoint), detailTr.TransformDirection(localDir)); if (!targetNode.DetailCollider.Collider.Raycast(rayCast, out var childHit, 500)) { DebugExtension.DrawPoint(childHit.point, Color.yellow, 0.25f, 2.5f); continue; } } var ce = new CollisionEvent(originEntity, sourceNode, targetNode, _rayHits[i].point, _rayHits[i].normal); hitEntity.Post(ce); originEntity.Post(new PerformedCollisionEvent(sourceNode, targetNode, _rayHits[i].point, _rayHits[i].normal)); return(ce); } } return(null); }
public static Entity GetEntity(Collider collider) { return(_colliderToDictionary.TryGetValue(collider, out var id) ? EntityController.GetEntity(id) : null); }
public static Entity GetEntity <T>(this T component) where T : IComponent { return(EntityController.GetComponentArray <T>().GetEntity(component)); }
public ConfuseSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(ConfuseImpact) })); }
public MoveTargetSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(MoveTarget) })); }
public SpellSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(SpellsContainer) })); }
public ModelSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(ModelLoaderComponent) })); }
public EntityFlightSystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(FlightMoveInput) })); }
public SpriteAnimationSystem() { _arraySpriteAnimation = EntityController.GetComponentArray <SpriteAnimationComponent>(); }
public static void PostSignal(int entity, int message) { EntityController.GetEntity(entity)?.Post(message); }
public CurrencySystem() { EntityController.RegisterReceiver(new EventReceiverFilter(this, new[] { typeof(CurrencyItem) })); }