public SyntaxNode SendEvent(TranslationContext translatorContext, ExpressionSyntax entity, Type eventType, ExpressionSyntax newEventSyntax)
        {
            if (m_Concurrent)
            {
                //throw new RoslynEcsTranslator.JobSystemNotCompatibleException("Sending event in job isn't implemented yet");
            }


            ExpressionSyntax bufferName = translatorContext.GetEventBufferWriter(translatorContext.IterationContext, entity, eventType, out var bufferInitialization);

            if (bufferInitialization != null)
            {
                translatorContext.AddStatement(bufferInitialization);
            }
            // EntityManager.GetBuffer<TestEvent2>(e).Add(<new event syntax>))
            return(InvocationExpression(
                       MemberAccessExpression(
                           SyntaxKind.SimpleMemberAccessExpression,
                           bufferName,
                           IdentifierName("Add")))
                   .WithArgumentList(
                       ArgumentList(
                           SingletonSeparatedList(
                               Argument(
                                   newEventSyntax))))
                   .NormalizeWhitespace());
        }
コード例 #2
0
 public virtual IdentifierNameSyntax GetEventBufferWriter(RoslynEcsTranslator.IterationContext iterationContext, ExpressionSyntax entity, Type eventType, out StatementSyntax bufferInitialization)
 {
     return(Parent.GetEventBufferWriter(iterationContext, entity, eventType, out bufferInitialization));
 }