Exemple #1
0
    // Does not append log if entity has no audit.
    // This prevents spam of entities that get retained every frame.
    // To enable log, add an audit component to the entity.
    // Likewise, to disable log, remove an audit component from the entity.
    // In visual debugging, there is a drop-down to add components.
    private static void AppendLog(IEntity entity, object owner)
    {
        IAuditEntity auditEntity = (IAuditEntity)entity;

        if (auditEntity == null)
        {
            return;
        }
        if (!auditEntity.hasAudit)
        {
            return;
        }
        List <string> logs = auditEntity.audit.logs;

        if (logs == null)
        {
            logs = new List <string>();
        }
        logs.Add(owner.ToString());
        auditEntity.ReplaceAudit(logs);
    }