Added decoration assets and placement. Currently all placeholders are replaced, need to implement a chance based system.
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,42 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://dk7gbkgg8vegy"
|
||||||
|
path="res://.godot/imported/Decorations.glb-a1a30e084725e695f1c19d3c9fcf7bdf.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Objects/Decorations.glb"
|
||||||
|
dest_files=["res://.godot/imported/Decorations.glb-a1a30e084725e695f1c19d3c9fcf7bdf.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
nodes/use_node_type_suffixes=true
|
||||||
|
meshes/ensure_tangents=true
|
||||||
|
meshes/generate_lods=true
|
||||||
|
meshes/create_shadow_meshes=true
|
||||||
|
meshes/light_baking=1
|
||||||
|
meshes/lightmap_texel_size=0.2
|
||||||
|
meshes/force_disable_compression=false
|
||||||
|
skins/use_named_skins=true
|
||||||
|
animation/import=true
|
||||||
|
animation/fps=30
|
||||||
|
animation/trimming=false
|
||||||
|
animation/remove_immutable_tracks=true
|
||||||
|
animation/import_rest_as_RESET=false
|
||||||
|
import_script/path=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={}
|
||||||
|
gltf/naming_version=2
|
||||||
|
gltf/embedded_image_handling=1
|
||||||
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Automation", "Automation.csproj", "{58DB29A5-5BE5-413A-BB24-673BF011E318}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RuinAdventurer", "RuinAdventurer.csproj", "{58DB29A5-5BE5-413A-BB24-673BF011E318}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Godot;
|
|||||||
|
|
||||||
public class Placeholder
|
public class Placeholder
|
||||||
{
|
{
|
||||||
string name;
|
public string name;
|
||||||
public Vector3 pos;
|
public Vector3 pos;
|
||||||
|
|
||||||
public Placeholder(string name, Vector3 pos){
|
public Placeholder(string name, Vector3 pos){
|
||||||
|
|||||||
@@ -27,4 +27,17 @@ public partial class ResourceLoader
|
|||||||
|
|
||||||
return tileMeshes;
|
return tileMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, MeshInstance3D> LoadDecorations()
|
||||||
|
{
|
||||||
|
Dictionary<string, MeshInstance3D> decorationMeshes = new Dictionary<string, MeshInstance3D>();
|
||||||
|
PackedScene decorationCollection = GD.Load<PackedScene>($"res://Assets/Objects/Decorations.glb");
|
||||||
|
Node root = decorationCollection.Instantiate();
|
||||||
|
foreach (MeshInstance3D child in root.GetChildren())
|
||||||
|
{
|
||||||
|
decorationMeshes.Add(child.Name.ToString().ToLower(), child);
|
||||||
|
}
|
||||||
|
|
||||||
|
return decorationMeshes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-5
@@ -1,11 +1,13 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using static GameData;
|
using static GameData;
|
||||||
|
|
||||||
public partial class World : Node3D
|
public partial class World : Node3D
|
||||||
{
|
{
|
||||||
public Dictionary<string, MeshInstance3D> tileMeshes;
|
public Dictionary<string, MeshInstance3D> tileMeshes;
|
||||||
|
public Dictionary<string, MeshInstance3D> decorationMeshes;
|
||||||
public Dictionary<string, List<Placeholder>> tilePlaceholders;
|
public Dictionary<string, List<Placeholder>> tilePlaceholders;
|
||||||
PackedScene layerPrefab = ResourceLoader.LoadLayerPrefab();
|
PackedScene layerPrefab = ResourceLoader.LoadLayerPrefab();
|
||||||
private Dictionary<string, MultiMeshInstance3D> multiMeshes = new();
|
private Dictionary<string, MultiMeshInstance3D> multiMeshes = new();
|
||||||
@@ -17,6 +19,7 @@ public partial class World : Node3D
|
|||||||
{
|
{
|
||||||
WFC.FillAdjacencies();
|
WFC.FillAdjacencies();
|
||||||
tileMeshes = ResourceLoader.LoadTiles();
|
tileMeshes = ResourceLoader.LoadTiles();
|
||||||
|
decorationMeshes = ResourceLoader.LoadDecorations();
|
||||||
tilePlaceholders = new Dictionary<string, List<Placeholder>>();
|
tilePlaceholders = new Dictionary<string, List<Placeholder>>();
|
||||||
foreach (var kvp in tileMeshes)
|
foreach (var kvp in tileMeshes)
|
||||||
{
|
{
|
||||||
@@ -113,12 +116,26 @@ public partial class World : Node3D
|
|||||||
mm.SetInstanceTransform(i, list[i]);
|
mm.SetInstanceTransform(i, list[i]);
|
||||||
if (placeholders.Count > 0)
|
if (placeholders.Count > 0)
|
||||||
{
|
{
|
||||||
Node3D robot;
|
Node3D decoration;
|
||||||
foreach (Placeholder placeholder in placeholders)
|
|
||||||
|
Mesh mesh = decorationMeshes.Values.ToList()[0].Mesh;
|
||||||
|
for(int j = 0; j < placeholders.Count; j++)
|
||||||
{
|
{
|
||||||
robot = ResourceLoader.LoadRobotPrefab().Instantiate<Node3D>();
|
foreach (MeshInstance3D meshes in decorationMeshes.Values)
|
||||||
robot.Position = placeholder.pos + list[i].Origin;
|
{
|
||||||
AddChild(robot);
|
if (meshes.Name.ToString().ToLower() == placeholders[j].name.ToLower())
|
||||||
|
{
|
||||||
|
mesh = meshes.Mesh;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
decoration = new MeshInstance3D();
|
||||||
|
(decoration as MeshInstance3D).Mesh = mesh;
|
||||||
|
decoration.Transform = list[i];
|
||||||
|
decoration.Position += placeholders[j].pos;
|
||||||
|
decoration.Name = placeholders[j].name + j;
|
||||||
|
decoration.Rotate(Vector3.Up, Mathf.DegToRad(-90));
|
||||||
|
layer.AddChild(decoration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user