protected virtual void DestroyEntity() { if (startup.world != null && entityValue.IsAlive()) { entityValue.Destroy(); } entityValue = EcsEntity.Null; }
public static void AddRecipient(EcsEntity e) { if (!e.IsAlive()) { return; } var player = e.Get <Player>(); recipients.Add(player.Connection.ClientConnection); }
public void Add(EcsEntity entity) { if (!entity.IsAlive()) { throw new Exception("Can't add entity to EntityList as it's not active."); } ResizeIfNeeded(); entities[count] = entity; count++; }
public void Erode() { if (map.IsNull() || !map.IsAlive()) { return; } FillParameters(map, true); map.Get <ErodeEvent>() = new ErodeEvent() { PrintTimers = PrintTimers }; }
private bool ValidateTarget() { if (target.IsNull() || !target.IsAlive()) { return(false); } var ce = target.Get <CombatEntity>(); if (!ce.IsValidTarget(CombatEntity)) { return(false); } return(true); }
void UpdateEntityName(EcsEntity entity, bool requestComponents) { var entityId = entity.GetInternalId(); var entityName = entityId.ToString("D8"); if (entity.IsAlive() && requestComponents) { var count = entity.GetComponentTypes(ref _componentTypesCache); for (var i = 0; i < count; i++) { entityName = $"{entityName}:{EditorHelpers.GetCleanGenericTypeName (_componentTypesCache[i])}"; _componentTypesCache[i] = null; } } EntityGameObjects[entityId].name = entityName; }
public bool IsValidTarget(CombatEntity source) { if (this == source) { return(false); } if (Entity.IsNull() || !Entity.IsAlive()) { return(false); } if (!Character.IsActive || Character.State == CharacterState.Dead) { return(false); } if (Character.Map == null) { return(false); } if (source.Character.Map != Character.Map) { return(false); } if (Character.SpawnImmunity > 0f) { return(false); } if (source.Character.ClassId == Character.ClassId) { return(false); } if (Character.ClassId == 1000) { return(false); //hack } return(true); }
public static bool IsNotNullAndAlive(this EcsEntity entity) { return !entity.IsNull() && entity.IsAlive(); }