Просмотр исходного кода

Added loading content tutorial. Several smaller improvements

Jorn Theunisen 6 лет назад
Родитель
Сommit
d7d037d271

+ 1 - 1
en/tutorials/csharpbeginner/add-component.md

@@ -1,5 +1,5 @@
 # Adding a component
-You can find this sample in the tutorial project: **Menu** -> **Adding a component** 
+You can find this sample in the tutorial project: **Menu** → **Adding a component** 
 
 ## Explanation
 This C# Beginner tutorial covers how to add and remove components. In the previous tutorial we learned how we can retrieve components that are already attached to an entity through the editor. This tutorial shows that we can accomplish the same thing by code. We can add the same component several times to the same entity. We also learn how to remove all of components of the same type again.

+ 1 - 1
en/tutorials/csharpbeginner/child-entities.md

@@ -1,5 +1,5 @@
 # Children of entities
-You can find this sample in the tutorial project: **Menu** -> **Child entities** 
+You can find this sample in the tutorial project: **Menu** → **Child entities** 
 
 ## Explanation
 This C# basics tutorial covers how to get an entities children. Since those children are also entities, we can retrieve their children too.

+ 1 - 1
en/tutorials/csharpbeginner/cloning-entities.md

@@ -1,5 +1,5 @@
 # Cloning an entity
-You can find this sample in the tutorial project: **Menu** -> **Cloning entities** 
+You can find this sample in the tutorial project: **Menu** → **Cloning entities** 
 
 ## Explanation
 This C# Beginner tutorial covers how to clone an existing entity and how to add that clone to the scene. A cloned entity is an exact copy of an entity, which means that the Transform and all other components with their set values are copied to.

+ 1 - 1
en/tutorials/csharpbeginner/delta-time.md

@@ -1,5 +1,5 @@
 # Delta Time
-You can find this sample in the tutorial project: **Menu** -> **Delta Time** 
+You can find this sample in the tutorial project: **Menu** → **Delta Time** 
 
 ## Explanation
 This C# Beginner tutorial covers the retrieval and usage of delta time. A games tries to update itself as often as possible. The amount of times it updates in a single second is called 'Frames Per Second' or shortened to 'FPS'. If we wanted to update a timer value, we would need a value that takes into account what the current amount of frames per second is. That is what delta time is used for. So whether your game runs 30 FPS or 120 FPS: you always want to have the same time scale.

+ 1 - 1
en/tutorials/csharpbeginner/editor-properties.md

@@ -1,5 +1,5 @@
 # Editor properties
-You can find this sample in the tutorial project: **Menu** -> **Editor properties** 
+You can find this sample in the tutorial project: **Menu** → **Editor properties** 
 
 ## Explanation
 This C# Beginner tutorial covers how to expose editor properties for Xenko Game Studio. By creating a public variable at the top of our script, we can create editor properties. Some of the most common properties are demonstrated. We can also create public variables that are not shown in the editor.

+ 1 - 1
en/tutorials/csharpbeginner/get-component.md

@@ -1,5 +1,5 @@
 # Getting a component
-You can find this sample in the tutorial project: **Menu** ->  **Getting a component** 
+You can find this sample in the tutorial project: **Menu** →  **Getting a component** 
 
 ## Explanation
 This C# beginner tutorial covers how to get and remove components. Components are the of the most important concepts in Xenko. Every entity in the scene has a list of components. The transform for instance is also a component. When we make custom scripts that inherit from SyncScript or AsyncScript, they turn into Components that we can attach to entities. We can attach these components to entities by using the editor or we can attach them by code.

+ 20 - 2
en/tutorials/csharpbeginner/index.md

@@ -232,7 +232,7 @@ These tutorials cover the beginner principles of using C# when working with the
        <h2>Linear Interpolation</h2>
     </div>
     <div class='xk-documentation-image'>
-        ![Linear Interpolation tutorial](media/linear-interpolation_thumb.png "Linear Interpolation tutorial") 
+        ![Linear Interpolation tutorial](media/lerp_thumb.png "Linear Interpolation tutorial") 
     </div>
     <div class='tutorial_description'>
         <ul>
@@ -241,6 +241,24 @@ These tutorials cover the beginner principles of using C# when working with the
             <li>Random values</li> 
         </ul>
     </div>
-    ](keyboard-input.md) 
+    ](linear-interpolation.md) 
+</div>
+
+<div class='tutorial'> 
+    [
+    <div class='tutorial_title'>
+       <h2>Loading content</h2>
+    </div>
+    <div class='xk-documentation-image'>
+        ![Loading content tutorial](media/loading-content_thumb.png "Loading content tutorial") 
+    </div>
+    <div class='tutorial_description'>
+        <ul>
+            <li>Loading content from code</li> 
+            <li>Unloading content</li> 
+            <li>Attach models to entities</li> 
+        </ul>
+    </div>
+    ](loading-content.md) 
 </div>
 

+ 1 - 1
en/tutorials/csharpbeginner/keyboard-input.md

@@ -1,5 +1,5 @@
 # Keyboard input
-You can find this sample in the tutorial project: **Menu** -> **Keyboard input** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Keyboard input** 
 
 ## Explanation
 This C# Beginner tutorial covers how to handle keyboard input. We can check for the existence of a keyboard and then we can use various methods to check if a key is pressed, held down or released.

+ 5 - 8
en/tutorials/csharpbeginner/linear-interpolation.md

@@ -1,14 +1,11 @@
 # Linear Interpolation
-You can find this sample in the tutorial project: **Menu** -> **Linear Iterpolation** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Linear Iterpolation** 
 
 ## Explanation
-This C# Beginner tutorial covers how to expose editor properties for Xenko Game Studio. By creating a public variable at the top of our script, we can create editor properties. Some of the most common properties are demonstrated. We can also create public variables that are not shown in the editor.
+This C# Beginner tutorial covers linear interpolation which is often shortened to 'Lerp'. Sometimes you want to gradually change a value from a start value to a target value. This process is called linear interpolation. Xenko exposes several Lerp functions for various types. Among them are Vector2, Vector3 and Vector4.
 
-![Editor properties](media/editor-properties2.png)
+![Linear interpolation](media/lerp.png)
 
 ## Code
-[!code-csharp[Entity](..\..\..\..\xenko\samples\Tutorials\CSharpBeginner\CSharpBeginner\CSharpBeginner.Game\Code\PropertiesDEmo.cs)]
-
-The code above will result in the following properties inside Xenko game studio.
-
-![Editor properties](media/editor-properties.png)
+The example consists of a simple timer that resets after a couple seconds. When the timer starts, a start position and a randomly generated target position are stored. A box will move between these two positions. Every frame a 'Lerp value' is calculated. The lerp value is used to determined what the current position of a moving box should be. Once the timer is done, the current position will become the start position and a new target position is again randomly generated.
+[!code-csharp[Lerp](..\..\..\..\xenko\samples\Tutorials\CSharpBeginner\CSharpBeginner\CSharpBeginner.Game\Code\LerpDemo.cs)]

+ 11 - 0
en/tutorials/csharpbeginner/loading-content.md

@@ -0,0 +1,11 @@
+# Loading content
+You can find this sample in the tutorial project: **Menu** &rarr; **Loading content from code** 
+
+## Explanation
+This C# Beginner tutorial covers how to load content from code. Assets like models, textures, sound etc can be loaded from during runtime. At that point we no longer speak of assets but of 'content'. This tutorial specifically loads content of the 'Model' type. Loaded content that is no longer required in your scene, should be unloaded again so save up memory. For more information on assets see [Manage assets](../../manual/game-studio/manage-assets.md) 
+
+![Loading content](media/loading-content.png)
+
+## Code
+With the L and U key you can either Load or Unload the model of a mannequin. If there is a model loaded, you can use the S key to spawn a new entity with the loaded mannequin model. The C clears all of the spawned entities in the scene. This demo demonstrates that when models are unloaded, any entities that reference the model are still existing in the scene.
+[!code-csharp[Loading content](..\..\..\..\xenko\samples\Tutorials\CSharpBeginner\CSharpBeginner\CSharpBeginner.Game\Code\LoadingContentDemo.cs)]

+ 3 - 0
en/tutorials/csharpbeginner/media/loading-content.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0462e910b481bf5d4bf0e0e1095e5e15b9b84c3755b470566d40cd6897116fde
+size 889444

+ 3 - 0
en/tutorials/csharpbeginner/media/loading-content_thumb.png

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:29f1c14a4d9d5e129f472ec26e448d4715d41d15ccb11202e21f17bcd312a2c6
+size 98972

+ 1 - 1
en/tutorials/csharpbeginner/mouse-input.md

@@ -1,5 +1,5 @@
 # Mouse input
-You can find this sample in the tutorial project: **Menu** -> **Mouse input** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Mouse input** 
 
 ## Explanation
 This C# Beginner tutorial covers how to handle mouse input. We can check for the existence of a mouse and then we can use various methods to check if a mouse buttons are clicked, held down or released. We can also for the mouse wheel (middle mouse) being clicked. We can use the mouse wheel delta to determine if the mouse wheel has been scrolled in a frame. And finally we learn how to use the absolute mouse position to draw text at the position of the mouse on the screen.

+ 1 - 1
en/tutorials/csharpbeginner/remove-entity.md

@@ -1,5 +1,5 @@
 # Removing an entity
-You can find this sample in the tutorial project: **Menu** -> **Removing an entity** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Removing an entity** 
 
 ## Explanation
 This C# Beginner tutorial covers how to get an entities children. Since those children are also entities, we can retrieve their children too.

+ 1 - 1
en/tutorials/csharpbeginner/removing-entities.md

@@ -1,5 +1,5 @@
 # Removing an entity
-You can find this sample in the tutorial project: **Menu** -> **Removing entities** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Removing entities** 
 
 ## Explanation
 This C# Beginner tutorial covers how to clone an existing entity and how to add that clone to the scene. A cloned entity is an exact copy, which means that the Transform properties and all other components are copied to.

+ 1 - 1
en/tutorials/csharpbeginner/transform-position.md

@@ -1,5 +1,5 @@
 # Transform Position
-You can find this sample in the tutorial project: **Menu** -> **Transform Position** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Transform Position** 
 
 ## Explanation
 This C# Beginner tutorial covers the Transform component of an entity. The Transform component is such a commonly used component, that you can quick access it via 'Entity.Transform'. The transform contains all kinds of properties and methods for Position, Rotation and Scale. In this example we learn the difference between local and world position.

+ 1 - 1
en/tutorials/csharpbeginner/virtual-buttons.md

@@ -1,5 +1,5 @@
 # Virtual buttons
-You can find this sample in the tutorial project: **Menu** -> **Virtual buttons** 
+You can find this sample in the tutorial project: **Menu** &rarr; **Virtual buttons** 
 
 ## Explanation
 This C# Beginner tutorial covers how to create virtual buttons. Lets say that you want a player to jump when a key is pressed. The space bar is a common option, but what if a gamer wants to have a different key bind to this 'Jump' action? The answer here is the 'Virtual button'. Virtual buttons allow the mapping of one or more keyboard keys, mouse buttons or joystick buttons to a single 'Virtual button'. We can check for the name of that virtual button to see if any of the virtual buttons are triggered.

+ 2 - 1
en/tutorials/toc.md

@@ -13,4 +13,5 @@
 ### [Keyboard input](csharpbeginner/keyboard-input.md) 
 ### [Mouse input](csharpbeginner/mouse-input.md) 
 ### [Virtual buttons](csharpbeginner/virtual-buttons.md)
-### [Linear Interpolation](csharpbeginner/linear-interpolation.md)
+### [Linear Interpolation](csharpbeginner/linear-interpolation.md)
+### [Loading content](csharpbeginner/loading-content.md)