sBotics Wiki

Tutorial do Simulador usado pela OBR

Ferramentas do usuário

Ferramentas do site


en:csharp

Diferenças

Aqui você vê as diferenças entre duas revisões dessa página.

Link para esta página de comparações

Ambos lados da revisão anteriorRevisão anterior
Próxima revisão
Revisão anterior
en:csharp [2025/07/18 21:27] adminen:csharp [2025/07/18 21:30] (atual) – [From rEduc] admin
Linha 5: Linha 5:
 Programming in C# brings some **BIG** differences from [[rEduc]], and can allow the user to use very advanced programming methods, but the learning curve is more difficult. Programming in C# brings some **BIG** differences from [[rEduc]], and can allow the user to use very advanced programming methods, but the learning curve is more difficult.
  
-> **Tip:** One of the most efficient ways to learn C# for the simulator is by building programs in rEduc and converting them to this language for reference. It is always possible to view rEduc commands in C# by clicking [[https://code.sbotics.net/programming/platforms/c0db56ec-619f-498f-9fbb-7835735f0f5e/languages/4224cf8e-f00c-4cc5-bd08-f0d22fad011d/functions?category=&cv=csharp|here]].+> **Tip:** One of the most efficient ways to learn C# for the simulator is by building programs in rEduc and converting them to this language for reference. It is always possible to view rEduc commands in C# by clicking [[https://code.sbotics.net/programming/platforms/c0db56ec-619f-498f-9fbb-7835735f0f5e/languages/4463851a-5ee8-4f64-b9b8-4434832ca312/functions?category=&cv=csharp|here]].
  
 Programming in C# in sBotics is done through **Asynchronous Tasks** (async Tasks), allowing the user to pause task execution through the ''%%await Time.Delay()%%'' command. Programming in C# in sBotics is done through **Asynchronous Tasks** (async Tasks), allowing the user to pause task execution through the ''%%await Time.Delay()%%'' command.
Linha 18: Linha 18:
 </code> </code>
  
-Every C# sBotics program needs to have a ''%%Task Main()%%'', the main block that will be called at the beginning of the [[Routine]] to execute the code.+Every C# sBotics program needs to have a ''%%Task Main()%%'', the main block that will be called at the beginning of the [[:Routine]] to execute the code.
  
 <code csharp> <code csharp>
Linha 28: Linha 28:
  
 ==== Important Warning about Busy-Waiting ==== ==== Important Warning about Busy-Waiting ====
-As already mentioned on the [[Programming]] page, the simulator and your code run on the same "layer" (thread). So your code DIRECTLY impacts the FPS ("frames per second", fluidity) of the simulator. Heavy code can end up pausing the simulator for a considerable time causing a crash. You **always** must use ''%%await%%'' to avoid holding the simulator too long in your code.+As already mentioned on the [[:Programming]] page, the simulator and your code run on the same "layer" (thread). So your code DIRECTLY impacts the FPS ("frames per second", fluidity) of the simulator. Heavy code can end up pausing the simulator for a considerable time causing a crash. You **always** must use ''%%await%%'' to avoid holding the simulator too long in your code.
  
 **Example:** The code below causes a crash in the simulator: **Example:** The code below causes a crash in the simulator:
Linha 401: Linha 401:
 There it is possible to understand exactly how the sensors work and know all the methods, classes, properties, enums, namespaces, etc. that the user has access to. There it is possible to understand exactly how the sensors work and know all the methods, classes, properties, enums, namespaces, etc. that the user has access to.
 ==== From rEduc ==== ==== From rEduc ====
-It is also possible to see the "translation" that rEduc makes to C# at [[https://code.sbotics.net/programming/platforms/c0db56ec-619f-498f-9fbb-7835735f0f5e/languages/4224cf8e-f00c-4cc5-bd08-f0d22fad011d/functions?category=&cv=csharp|sBotics Functions]], and see exactly the name of each rEduc command and its equivalent C# code for study purposes.+It is also possible to see the "translation" that rEduc makes to C# at [[https://code.sbotics.net/programming/platforms/c0db56ec-619f-498f-9fbb-7835735f0f5e/languages/4463851a-5ee8-4f64-b9b8-4434832ca312/functions?category=&cv=csharp|sBotics Functions]], and see exactly the name of each rEduc command and its equivalent C# code for study purposes.
  
 ------- -------
en/csharp.1752874023.txt.gz · Última modificação: 2025/07/18 21:27 por admin