PlaceWithRelatedModule requirement, finish Puzzle D
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using EscapeRoomEngine.Engine.Runtime.Utilities;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -14,6 +14,13 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
SW, S, SE
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct TilePrefab
|
||||
{
|
||||
public TileLocation location;
|
||||
public GameObject prefab;
|
||||
}
|
||||
|
||||
public class SpaceTile : MonoBehaviour
|
||||
{
|
||||
public static HashSet<TileLocation> EveryTileLocation => new(new[]
|
||||
@@ -24,7 +31,7 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
});
|
||||
|
||||
[BoxGroup("Style Prefabs")] [SerializeField]
|
||||
private UDictionary<TileLocation, GameObject> tilePrefabs;
|
||||
private List<TilePrefab> tilePrefabs;
|
||||
[BoxGroup("Style Prefabs")] [SerializeField]
|
||||
private Material material;
|
||||
|
||||
@@ -53,9 +60,13 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
Destroy(_tile);
|
||||
}
|
||||
|
||||
_tile = Instantiate(tilePrefabs[showTile], transform);
|
||||
_tile = Instantiate(tilePrefabs.Find(tilePrefab => tilePrefab.location == showTile).prefab, transform);
|
||||
_tile.isStatic = true;
|
||||
_tile.GetComponent<MeshRenderer>().material = material;
|
||||
|
||||
var tileCollider = _tile.AddComponent<MeshCollider>();
|
||||
tileCollider.convex = true;
|
||||
tileCollider.sharedMesh = _tile.GetComponent<MeshFilter>().sharedMesh;
|
||||
|
||||
_showTile = showTile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user