浏览代码

Merge pull request #8109 from strobelt/add-csharp-tips-to-jump-and-squash-3d-tutorial

Add C# Tips to 3d tutorial game step 6
Max Hilbrunner 1 年之前
父节点
当前提交
4f5b70c45a
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      getting_started/first_3d_game/06.jump_and_squash.rst

+ 6 - 0
getting_started/first_3d_game/06.jump_and_squash.rst

@@ -269,6 +269,8 @@ With this code, if no collisions occurred on a given frame, the loop won't run.
             KinematicCollision3D collision = GetSlideCollision(index);
             KinematicCollision3D collision = GetSlideCollision(index);
 
 
             // If the collision is with a mob.
             // If the collision is with a mob.
+            // With C# we leverage typing and pattern-matching
+            // instead of checking for the group we created.
             if (collision.GetCollider() is Mob mob)
             if (collision.GetCollider() is Mob mob)
             {
             {
                 // We check that we are hitting it from above.
                 // We check that we are hitting it from above.
@@ -344,6 +346,10 @@ destroy the mob.
         QueueFree();
         QueueFree();
     }
     }
 
 
+.. note::
+
+    When using C#, Godot will create the appropriate events automatically for all Signals ending with `EventHandler`, see :ref:`C# Signals <doc_c_sharp_signals>`.
+
 We will use the signal to add points to the score in the next lesson.
 We will use the signal to add points to the score in the next lesson.
 
 
 With that, you should be able to kill monsters by jumping on them. You can press
 With that, you should be able to kill monsters by jumping on them. You can press