Skip to content

Commit

Permalink
Updated first 10 tutorials
Browse files Browse the repository at this point in the history
# Conflicts:
#	samples/Tutorials/CSharpBeginner/CSharpBeginner/CSharpBeginner.Game/Code/RemoveEntitiesDemo.cs
  • Loading branch information
Aggror committed Jun 15, 2020
1 parent 81ced3b commit 84262fd
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Physics" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Physics" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/Templates/Packs/mannequinModel/mannequinModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta04" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Core" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta03-1036" PrivateAssets="contentfiles;analyzers" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ SharedRenderers:
TransparentRenderStage: ref!! 5a243378-ab43-4a6d-a7e1-50a672ab8b87
ShadowMapRenderStages:
fc4d1e0de5c2b0bbc27bcf96e9a848fd: ref!! 07363ce1-02a6-45e6-b698-23cad0b3fbae
87ff1d9cdd52418daf76385176a0e316: ref!! 2d9f1bbe-cdc1-4f2e-b0f7-849d4a686435
5e059d4cc2db4ee8a1f28a40f4ac3ae8: ref!! ee671c29-af53-436e-ad61-682a5a57d2d8
GBufferRenderStage: ref!! 619b9ff9-c0fc-476f-a4bf-fc6742f1e379
PostEffects: !PostProcessingEffects ref!! e92497d4-8f9d-4dbd-980c-3fa2d34cdd4a
LightShafts: null
Expand All @@ -148,8 +146,6 @@ SharedRenderers:
TransparentRenderStage: ref!! 5a243378-ab43-4a6d-a7e1-50a672ab8b87
ShadowMapRenderStages:
2323a99a8a983e182f318e55604659b0: ref!! 07363ce1-02a6-45e6-b698-23cad0b3fbae
61b557b74893400898c007d5ece5e87f: ref!! 2d9f1bbe-cdc1-4f2e-b0f7-849d4a686435
5c382f66ee524c498d26d9aaf19fc9c3: ref!! ee671c29-af53-436e-ad61-682a5a57d2d8
GBufferRenderStage: ref!! 619b9ff9-c0fc-476f-a4bf-fc6742f1e379
PostEffects: null
LightShafts: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ Hierarchy:
Id: 418bb6a9-91fd-4a9c-95f1-0d4f5b8a29e9
Model: 32c1ef96-e4a0-49a2-b286-b932c6d43f49:Models/MachinegunModel
Materials: {}
e374f7b498051c200f190c1102c08b41: !CSharpBeginner.Code.AddingAComponentDemo,CSharpBeginner.Game
Id: a8cdbb88-4224-4400-859d-3c522c3defaa
6a6bc62754f2441b5aa298440f73ce46: !CSharpBeginner.Code.AddingAComponentDemo,CSharpBeginner.Game
Id: 192d2435-4477-4a07-8354-91e07ac8e63f
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Hierarchy:
53e58ce1c35e07b6d9f3c23aedfd4bad: !TransformComponent
Id: 7f3fb363-4d16-4b0c-a70d-d470c5a2f152
Position: {X: 0.0, Y: 0.223615482, Z: 1.0}
Rotation: {X: 0.49999997, Y: 0.49999997, Z: -0.49999997, W: 0.49999997}
Rotation: {X: 0.707106769, Y: 0.0, Z: 0.0, W: 0.707106769}
Scale: {X: 1.0, Y: 1.0, Z: 1.0}
Children: {}
d39c34acc25c776a05897e9accc31423: !ModelComponent
Expand Down Expand Up @@ -49,10 +49,13 @@ Hierarchy:
Components:
53e58ce1c35e07b6d9f3c23aedfd4bad: !TransformComponent
Id: 211f4814-ea05-4e32-81ea-a82f7b2a5327
Position: {X: 0.0, Y: 0.0, Z: 1.0}
Position: {X: 0.0, Y: 0.0, Z: 0.0}
Rotation: {X: 0.0, Y: 0.0, Z: 0.0, W: 1.0}
Scale: {X: 1.0, Y: 1.0, Z: 1.0}
Children: {}
414c67464c2be14e49146097592d105a: !CSharpBeginner.Code.CloneEntityDemo,CSharpBeginner.Game
Id: 6cb5ddc0-0094-416f-812f-41f4eb7d7240
04e0a638a65ec92d859a995145673ea6: !CSharpBeginner.Code.CloneEntityDemo,CSharpBeginner.Game
Id: bc693c9b-1c06-4f7c-b7e0-2dbcd2752df3
MasterSword: ref!! 346b2666-8a52-49c2-8a90-53d3e1aeec69
clone1: null
clone2: null
clone3: null
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ Hierarchy:
Id: 210bc310-d21a-44a9-bccf-173c4926a47d
Model: f68ea240-695a-4de5-9884-60d77544fcd6:Models/mannequinModel
Materials: {}
3e42ba7a5d85c5f92dc2c5097deed788: !CSharpBeginner.Code.DeltaTimeDemo,CSharpBeginner.Game
Id: d1936f8d-349f-41cd-a753-b06c74b7abf3
83e36a04eb04bebb41bd5077a76714b6: !CSharpBeginner.Code.DeltaTimeDemo,CSharpBeginner.Game
Id: ec4745f4-aa61-428b-935a-20ecc241fd7e
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Hierarchy:
Id: d6bb0120-4c94-429e-add0-d7f238018dcb
Model: d3f4cbe1-353f-4367-9f44-df64df144f71:Models/MagazineModel
Materials: {}
9daf0818bfaee33fec0ebdbdbc5aa2a6: !CSharpBeginner.Code.AmmoComponent,CSharpBeginner.Game
Id: 104afc5f-d0af-40da-9e21-18337d8e5f04
ef7188b718f01770f2389448d1a13c88: !CSharpBeginner.Code.GettingAComponentDemo,CSharpBeginner.Game
Id: dcc8ad10-7ad3-4ddd-b5b0-db58e896de8f
bb54b086d4b903d10332ad1ee446d74f: !CSharpBeginner.Code.GettingAComponentDemo,CSharpBeginner.Game
Id: 90a6c833-6ef3-438d-a693-3470a6ac2b64
f0ba3d5443e298ae0fc8dcb7c3f70bde: !CSharpBeginner.Code.AmmoComponent,CSharpBeginner.Game
Id: c372991c-7ebe-466c-ac10-2b2e64b958ad
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Hierarchy:
Id: 553094b2-8ac6-460c-b96c-a40b03e4aa3a
Model: d6eb9b8a-c70a-4d55-8da5-9dc32528d6bd:Models/MaterialModel
Materials: {}
030397cc264be3084d8f2464a887bb2f: !CSharpBeginner.Code.GettingTheEntityDemo,CSharpBeginner.Game
Id: 0854d776-b102-42d3-ae24-1207e8592251
3fe56bbaae75a8818e907cdbf0b0ed0c: !CSharpBeginner.Code.GettingTheEntityDemo,CSharpBeginner.Game
Id: a5759b52-1f81-4ed1-9fc5-017a346aaac6
- Entity:
Id: a2e2cfe6-97bd-4f96-9930-ef8dea168845
Name: Camera
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ Hierarchy:
Id: 5fcd6a69-60f9-4a7f-a871-cf0219d6650b
Model: e288f24b-258b-4875-85bb-a696a7445a7c:Models/BoxF
Materials: {}
4045262021e6e62289f01a5704d862b6: !CSharpBeginner.Code.LerpDemo,CSharpBeginner.Game
Id: 300d7f8d-2f0f-4ee9-91fb-eeb2ca71bff4
AnimationTimer: 5.0
- Entity:
Id: f0878308-3e3c-4539-9dcb-b810bd514a23
Name: Camera
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ Hierarchy:
Rotation: {X: 0.0, Y: 0.0, Z: 0.0, W: 1.0}
Scale: {X: 1.0, Y: 1.0, Z: 1.0}
Children: {}
cb3ed9ba99c144388946f20322304dd6: !CSharpBeginner.Code.LoadingContentDemo,CSharpBeginner.Game
Id: 1242bdfc-f59f-4388-aee9-7039818fa78b
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ Hierarchy:
Id: bb1a8336-df79-4dd5-91e9-097573df3de5
Model: 9428ef8e-2243-4558-b3ac-47bc3f0441bf:Models/BoxC
Materials: {}
616eadece9618158b776b329a73e28b2: !CSharpBeginner.Code.TransformPositionDemo,CSharpBeginner.Game
Id: 5461050b-4a07-4a49-80d1-9a6d617fe84e
e3ce33e22c6b05c10deb3867b24064e7: !CSharpBeginner.Code.TransformPositionDemo,CSharpBeginner.Game
Id: acaef43d-edcd-4c42-b26e-6c15121b7ca0
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ Hierarchy:
Rotation: {X: 0.0, Y: 0.0, Z: 0.0, W: 1.0}
Scale: {X: 1.0, Y: 1.0, Z: 1.0}
Children: {}
7b07303d94cfcc6f7d52ada9306e8358: !CSharpBeginner.Code.VirtualButtonsDemo,CSharpBeginner.Game
Id: d633e0b7-9085-434b-acdf-5a7c690879fb
BlueTeapot: ref!! 842c111f-8523-40b6-ac65-314d6167c8c9
- Entity:
Id: 842c111f-8523-40b6-ac65-314d6167c8c9
Name: Blue Teapot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,8 @@ Hierarchy:
Page: 5175f272-13da-45dd-9f7b-540e7121dd56:UI/LoadTutorialUI
Resolution: {X: 1280.0, Y: 720.0, Z: 1000.0}
Size: {X: 1.0, Y: 1.0, Z: 1.0}
a071ed0a8246a83ec97aadc7a70f4da8: !CSharpBeginner.Code.TutorialUI,CSharpBeginner.Game
Id: 243d53f1-6acd-4a38-aee8-14bf536d1f0f
c39e507eff9e95b1921762d65324d8a5: !CSharpBeginner.Code.TutorialUI,CSharpBeginner.Game
Id: 7920ca63-c911-40bf-b358-7bcfab540966
Camera: ref!! 11c51eca-f227-48c5-afdb-199ed1d275cf
- Entity:
Id: d85c827e-72b6-48fd-8a88-97d01983bebb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<RootNamespace>CSharpBeginner</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.Video" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.Physics" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.Navigation" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.Particles" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.UI" Version="4.0.0.1-beta04" />
<PackageReference Include="Stride.Core.Assets.CompilerApp" Version="4.0.0.1-beta04" IncludeAssets="build;buildTransitive" />
<PackageReference Include="Stride.Engine" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.Video" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.Physics" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.Navigation" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.Particles" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.UI" Version="4.0.0.1-beta03-1036" />
<PackageReference Include="Stride.Core.Assets.CompilerApp" Version="4.0.0.1-beta03-1036" IncludeAssets="build;buildTransitive" />
<ProjectReference Include="..\..\..\..\Templates\Packs\PrototypingBlocks\PrototypingBlocks.csproj" />
<ProjectReference Include="..\..\..\..\Templates\Packs\mannequinModel\mannequinModel.csproj" />
<ProjectReference Include="..\..\..\..\Templates\Packs\SamplesAssetPackage\SamplesAssetPackage.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ public override void Start()
Entity.RemoveAll<AmmoComponent>();


// When there is no component of this type attached, but we like there to be one, we can create it automatically
// NOTE: when a component is created like this, the 'Start' method will be called after this script's Update method has executed
// When there is no AmmoComponent of attached, but we like there to be one, we can create it automatically
// NOTE: when a component is created this way,
// the 'Start' method of the AmmoComponent will be called after this script's Update method has executed
ammoComponent3 = Entity.GetOrCreate<AmmoComponent>();
}

public override void Update()
{
DebugText.Print("Total of ammo of the automatically created AmmoComponent3: " + ammoComponent3.GetTotalAmmo().ToString(), new Int2(440, 200));
DebugText.Print("Remaining ammo: " + ammoComponent3.GetRemainingAmmo().ToString(), new Int2(440, 200));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,57 @@ namespace CSharpBeginner.Code
public class CloneEntityDemo : SyncScript
{
public Entity MasterSword;
private Entity clone0;

private Entity clone1;
private Entity clone2;
private Entity clone3;

public override void Start()
{
// Clone 0
// The Clone method clones an existing entity.
// The Clone method clones an existing entity, including all of its components
// However, if we don't add it to the scene, we will never get to see it.
clone0 = MasterSword.Clone();
var clone0 = MasterSword.Clone();
clone0.Transform.Position += new Vector3(0, 1, 0);


// Clone 1
clone1 = MasterSword.Clone();

// We can add Clone1 to the same scene that the current entity is part of
clone1 = MasterSword.Clone();
Entity.Scene.Entities.Add(clone1);

// The cloned entity will be at the same worldposition as the original Sword entity
// Move it to the right so that we can see it
clone1.Transform.Position += new Vector3(-1, 0, 0);
clone1.Transform.Scale = new Vector3(1.3f);
clone1.Transform.Scale *= new Vector3(0.8f);


// Clone 2
// We can also add a cloned entity as a child of an existing entity.
clone2 = MasterSword.Clone();
Entity.AddChild(clone2);
clone2.Transform.Position += new Vector3(1, 0, 0);
clone2.Transform.Scale = new Vector3(0.6f);

// We can also add a cloned entity as a child of an existing entity.
// That means it will use the parent's world position + parent's local position
clone2.Transform.Parent = Entity.Transform;

// Scale it up in all axes so we can clearly see it
clone2.Transform.Scale = new Vector3(1.6f);
// Clone 3
// We can also add a cloned entity as a child of an existing entity by setting the parent
// That means it will use the parent's world position + parent's local position
clone3 = MasterSword.Clone();
clone3.Transform.Parent = Entity.Transform; // Or Entity.SetParent(Entity.Transform)
clone3.Transform.Position += new Vector3(0, 0, -0.5f);
clone3.Transform.Scale = new Vector3(0.4f);
}

public override void Update()
{
DebugText.Print("Clone 0 has not been added to the scene and is therefore not visible", new Int2(330, 680));
DebugText.Print("This is the MasterSword, with a Z of 1", new Int2(320, 520));
DebugText.Print("This is the MasterSword, with a Z of 1", new Int2(500, 320));
DebugText.Print("Clone 0 has not been added to the scene and is therefore not visible", new Int2(600, 250));

DebugText.Print("Clone 1 is placed in the same scene as the entity with the script", new Int2(700, 500));
DebugText.Print("Clone 1 got the same world position as the 'MasterSword'...", new Int2(700, 520));
DebugText.Print("... and was then moved to the right", new Int2(700, 540));
DebugText.Print("Clone 1 is placed in the same scene as the entity with the script", new Int2(700, 600));
DebugText.Print("Clone 1 got the same world position as the 'MasterSword'...", new Int2(700, 620));
DebugText.Print("... and was then moved to the right", new Int2(700, 640));

DebugText.Print("Clone 2 is a child of 'MasterSword'.", new Int2(580, 180));
DebugText.Print("Clone 2 got the same world position + local position of the 'MasterSword'", new Int2(580, 200));
DebugText.Print("Clone 2 and 3 are a child of 'MasterSword'.", new Int2(330, 600));
}
}
}
Loading

0 comments on commit 84262fd

Please sign in to comment.