Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Add asset class generator and rename all used name to the Generated f… #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SamplyGame/Core/Aircrafts/Enemies/EnemySkull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ protected override void Init()
var cache = Application.ResourceCache;
var node = Node;
var model = node.CreateComponent<StaticModel>();
model.Model = cache.GetModel(Assets.Models.Enemy2);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Enemy2).Clone(""));
model.Model = cache.GetModel(Assets.Models.Enemy4);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Enemy4DD).Clone(""));
node.SetScale(0.15f);
node.Position = new Vector3(0f, 5f, 0f);

Expand Down
4 changes: 2 additions & 2 deletions SamplyGame/Core/Aircrafts/Enemies/EnemyXamonkey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ protected override async void Init()
var cache = Application.ResourceCache;
var node = Node;
var model = node.CreateComponent<StaticModel>();
model.Model = cache.GetModel(Assets.Models.Enemy1);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Enemy1).Clone(""));
model.Model = cache.GetModel(Assets.Models.Monkey);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Monkey).Clone(""));
node.SetScale(RandomHelper.NextRandom(0.1f, 0.12f));
node.Position = new Vector3(0f, 5f, 0f);

Expand Down
4 changes: 2 additions & 2 deletions SamplyGame/Core/Aircrafts/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ protected override async void Init()
var cache = Application.ResourceCache;
var node = Node;
var model = node.CreateComponent<StaticModel>();
model.Model = cache.GetModel(Assets.Models.Player);
var material = cache.GetMaterial(Assets.Materials.Player).Clone("");
model.Model = cache.GetModel(Assets.Models.Player1);
var material = cache.GetMaterial(Assets.Materials.Player1D).Clone("");
model.SetMaterial(material);

node.SetScale(0.35f);
Expand Down
63 changes: 0 additions & 63 deletions SamplyGame/Core/Assets.cs

This file was deleted.

4 changes: 2 additions & 2 deletions SamplyGame/Core/Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ Node CreateTile(int index)
treeNode.Rotate(new Quaternion(0, RandomHelper.NextRandom(0, 5) * 90, 0), TransformSpace.Local);
treeNode.Scale = new Vector3(0.3f, 0.4f, 0.3f);
var treeGroup = treeNode.CreateComponent<StaticModel>();
treeGroup.Model = cache.GetModel(Assets.Models.Tree);
treeGroup.SetMaterial(cache.GetMaterial(Assets.Materials.Pyramid));
treeGroup.Model = cache.GetModel(Assets.Models.PyramidTree);
treeGroup.SetMaterial(cache.GetMaterial(Assets.Materials.PyramidMaterial));

for (float i = -sizeX; i < sizeX; i += 3.2f)
{
Expand Down
15 changes: 14 additions & 1 deletion SamplyGame/Core/SamplyGame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
<Compile Include="Aircrafts\Aircraft.cs" />
<Compile Include="Aircrafts\Enemies\EnemySkull.cs" />
<Compile Include="Aircrafts\Enemies\Enemies.cs" />
<Compile Include="Assets.cs" />
<Compile Include="UrhoAssetGenerator.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>UrhoAssetGenerator.tt</DependentUpon>
</Compile>
<Compile Include="Weapons\Apple.cs" />
<Compile Include="Aircrafts\Enemies\Enemy.cs" />
<Compile Include="Aircrafts\Enemies\EnemyXamonkey.cs" />
Expand Down Expand Up @@ -65,6 +69,15 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="UrhoAssetGenerator.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>UrhoAssetGenerator.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
8 changes: 4 additions & 4 deletions SamplyGame/Core/StartMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public async Task ShowStartMenu(bool gameOver)

if (gameOver)
{
model.Model = cache.GetModel(Assets.Models.Enemy1);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Enemy1).Clone(""));
model.Model = cache.GetModel(Assets.Models.Monkey);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Monkey).Clone(""));
bigAircraft.SetScale(0.3f);
bigAircraft.Rotate(new Quaternion(180, 90, 20), TransformSpace.Local);
}
else
{
model.Model = cache.GetModel(Assets.Models.Player);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Player).Clone(""));
model.Model = cache.GetModel(Assets.Models.Player1);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Player1D).Clone(""));
bigAircraft.SetScale(1f);
bigAircraft.Rotate(new Quaternion(0, 40, -50), TransformSpace.Local);
}
Expand Down
Loading