Browse Source

update c# examples and fix ref links

Hana 2 years ago
parent
commit
f726757663

+ 6 - 2
getting_started/first_3d_game/03.player_movement_code.rst

@@ -30,7 +30,9 @@ character.
 
  .. code-tab:: csharp
 
-    public class Player : CharacterBody3D
+    using Godot;
+
+    public partial class Player : CharacterBody3D
     {
         // Don't forget to rebuild the project so the editor knows about the new export variable.
 
@@ -274,7 +276,9 @@ Here is the complete ``Player.gd`` code for reference.
         move_and_slide()
  .. code-tab:: csharp
 
-    public class Player : CharacterBody3D
+    using Godot;
+
+    public partial class Player : CharacterBody3D
     {
         // How fast the player moves in meters per second.
         [Export]

+ 8 - 4
getting_started/first_3d_game/04.mob_scene.rst

@@ -61,7 +61,7 @@ want to pay for it when the mob is outside the screen.
 
 Once a monster leaves the screen, we don't need it anymore, so we should delete it.
 Godot has a node that detects when objects leave the screen,
-:ref:`VisibleOnScreenNotifier3D <class_VisibileOnScreenNotifier3D>`, and we're going to use it to destroy our mobs.
+:ref:`VisibleOnScreenNotifier3D <class_VisibleOnScreenNotifier3D>`, and we're going to use it to destroy our mobs.
 
 .. note::
 
@@ -76,7 +76,7 @@ Godot has a node that detects when objects leave the screen,
     reference counting, which doesn't have that caveat. You can learn more
     about that here: :ref:`doc_gdscript_basics_memory_management`.
 
-Select the ``Mob`` node and add a child node :ref:`VisibleOnScreenNotifier3D <class_VisibileOnScreenNotifier3D>`. Another
+Select the ``Mob`` node and add a child node :ref:`VisibleOnScreenNotifier3D <class_VisibleOnScreenNotifier3D>`. Another
 box, pink this time, appears. When this box completely leaves the screen, the
 node will emit a signal.
 
@@ -117,7 +117,9 @@ and ``max_speed``, to define a random speed range, which we will later use to de
 
  .. code-tab:: csharp
 
-    public class Mob : CharacterBody3D
+    using Godot;
+
+    public partial class Mob : CharacterBody3D
     {
         // Don't forget to rebuild the project so the editor knows about the new export variable.
 
@@ -282,7 +284,9 @@ Here is the complete ``Mob.gd`` script for reference.
         queue_free()
  .. code-tab:: csharp
 
-    public class Mob : CharacterBody3D
+    using Godot;
+
+    public partial class Mob : CharacterBody3D
     {
         // Minimum speed of the mob in meters per second
         [Export]

+ 6 - 2
getting_started/first_3d_game/05.spawning_mobs.rst

@@ -175,7 +175,9 @@ always spawn following the same sequence.
 
  .. code-tab:: csharp
 
-    public class Main : Node
+    using Godot;
+
+    public partial class Main : Node
     {
         // Don't forget to rebuild the project so the editor knows about the new export variable.
 
@@ -312,7 +314,9 @@ Here is the complete ``Main.gd`` script so far, for reference.
 
  .. code-tab:: csharp
 
-    public class Main : Node
+    using Godot;
+
+    public partial class Main : Node
     {
     #pragma warning disable 649
         [Export]

+ 9 - 3
getting_started/first_3d_game/07.killing_player.rst

@@ -191,7 +191,9 @@ Starting with ``Main.gd``.
         $MobTimer.stop()
  .. code-tab:: csharp
 
-    public class Main : Node
+    using Godot;
+
+    public partial class Main : Node
     {
     #pragma warning disable 649
         [Export]
@@ -271,7 +273,9 @@ Next is ``Mob.gd``.
         queue_free() # Destroy this node
  .. code-tab:: csharp
 
-    public class Mob : CharacterBody3D
+    using Godot;
+
+    public partial class Mob : CharacterBody3D
     {
         // Emitted when the played jumped on the mob.
         [Signal]
@@ -399,7 +403,9 @@ Finally, the longest script, ``Player.gd``:
         die()
  .. code-tab:: csharp
 
-    public class Player : CharacterBody3D
+    using Godot;
+
+    public partial class Player : CharacterBody3D
     {
         // Emitted when the player was hit by a mob.
         [Signal]

+ 6 - 2
getting_started/first_3d_game/08.score_and_replay.rst

@@ -96,7 +96,9 @@ the ``score`` variable.
 
  .. code-tab:: csharp
 
-    public class ScoreLabel : Label
+    using Godot;
+
+    public partial class ScoreLabel : Label
     {
         private int _score = 0;
     }
@@ -413,7 +415,9 @@ Here is the complete ``Main.gd`` script for reference.
             get_tree().reload_current_scene()
  .. code-tab:: csharp
 
-    public class Main : Node
+    using Godot;
+
+    public partial class Main : Node
     {
     #pragma warning disable 649
         [Export]

+ 6 - 2
getting_started/first_3d_game/09.adding_animations.rst

@@ -380,7 +380,9 @@ Here's the *Player* script.
         die()
  .. code-tab:: csharp
 
-    public class Player : CharacterBody3D
+    using Godot;
+
+    public partial class Player : CharacterBody3D
     {
         // Emitted when the player was hit by a mob.
         [Signal]
@@ -520,7 +522,9 @@ And the *Mob*'s script.
         queue_free() # Destroy this node
  .. code-tab:: csharp
 
-    public class Mob : CharacterBody3D
+    using Godot;
+
+    public partial class Mob : CharacterBody3D
     {
         // Emitted when the played jumped on the mob.
         [Signal]