Fixed various indexing issues so board can be displayed now
This commit is contained in:
parent
7034c1d662
commit
6b25bbacac
|
@ -17,7 +17,7 @@ using TileStack = System.Collections.Generic.List<TileInfo>;
|
||||||
|
|
||||||
#region Board Logic
|
#region Board Logic
|
||||||
public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
BoardState board = new BoardState();
|
public BoardState board = new BoardState();
|
||||||
|
|
||||||
public override void Deserialize(Hashtable h) {
|
public override void Deserialize(Hashtable h) {
|
||||||
base.Serialize(h);
|
base.Serialize(h);
|
||||||
|
@ -37,6 +37,13 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
|
|
||||||
[ContextMenu("Test board")]
|
[ContextMenu("Test board")]
|
||||||
public void TestBoard() {
|
public void TestBoard() {
|
||||||
|
board = new BoardState();
|
||||||
|
/*board[0] = new TileStack(new[] {
|
||||||
|
new TileInfo(1),
|
||||||
|
new TileInfo(10),
|
||||||
|
new TileInfo(100),
|
||||||
|
new TileInfo(1000),
|
||||||
|
});*/
|
||||||
for(int i = 0; i < BoardState.BoardWidth; ++i) {
|
for(int i = 0; i < BoardState.BoardWidth; ++i) {
|
||||||
board[i] = new TileStack(new[] { Random, Random, Random });
|
board[i] = new TileStack(new[] { Random, Random, Random });
|
||||||
}
|
}
|
||||||
|
@ -45,7 +52,7 @@ public class GameBoard : EntityBase, IAutoSerialize, IAutoDeserialize {
|
||||||
[ContextMenu("Test Board Serialization")]
|
[ContextMenu("Test Board Serialization")]
|
||||||
public void TestSerialize() {
|
public void TestSerialize() {
|
||||||
board = BoardState.Copy(board);
|
board = BoardState.Copy(board);
|
||||||
//Debug.Log(board.ToHashtable());
|
Debug.Log(board.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +75,7 @@ public enum TileColor : byte {
|
||||||
Bomb = 202, // 3x3 radius destruction
|
Bomb = 202, // 3x3 radius destruction
|
||||||
Dynamite = 203, // 5x5 cross destruction
|
Dynamite = 203, // 5x5 cross destruction
|
||||||
Seal = 204, // destroys all matching color on landing
|
Seal = 204, // destroys all matching color on landing
|
||||||
Mystery = 205, // Becomes random basic on destroy
|
Mystery = 205, // Becomes random basic on destroy, otherwise as rock
|
||||||
Wildcard = 206, // Pairs with any
|
Wildcard = 206, // Pairs with any
|
||||||
Spark = 207 // Removes entire column on create
|
Spark = 207 // Removes entire column on create
|
||||||
}
|
}
|
||||||
|
@ -118,7 +125,7 @@ public class TileInfo {
|
||||||
|
|
||||||
public TileInfo(TileColor c, byte detail = 1) {
|
public TileInfo(TileColor c, byte detail = 1) {
|
||||||
// Make a new Tile from the color, assuming detail with a default
|
// Make a new Tile from the color, assuming detail with a default
|
||||||
var ti = new TileInfo((byte)c & ((detail & (byte)0xFF) << 8));
|
var ti = new TileInfo((byte)detail | (((byte)c & (byte)0xFF) << 8));
|
||||||
data = ti.data; // Create garbage but whatever
|
data = ti.data; // Create garbage but whatever
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,12 +159,12 @@ public class TileInfo {
|
||||||
case TileDetail.Normal:
|
case TileDetail.Normal:
|
||||||
goto default;
|
goto default;
|
||||||
default:
|
default:
|
||||||
return Air();
|
return Air;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make and return a new air tile
|
// Make and return a new air tile
|
||||||
public static TileInfo Air() => new TileInfo(0); // Just air
|
public static TileInfo Air => new TileInfo(0); // Just air
|
||||||
public bool isAir => data == 0;
|
public bool isAir => data == 0;
|
||||||
|
|
||||||
public static implicit operator int(TileInfo ti) => ti.data;
|
public static implicit operator int(TileInfo ti) => ti.data;
|
||||||
|
@ -207,7 +214,7 @@ public class BoardState {
|
||||||
public bool TryCol(int col, out TileStack ts) {
|
public bool TryCol(int col, out TileStack ts) {
|
||||||
ts = null;
|
ts = null;
|
||||||
if (col < 0) return false;
|
if (col < 0) return false;
|
||||||
if (col > BoardWidth) return false;
|
if (col > state.Count) return false;
|
||||||
ts = this[col];
|
ts = this[col];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -220,8 +227,12 @@ public class BoardState {
|
||||||
if (!TryCol(x, out TileStack col))
|
if (!TryCol(x, out TileStack col))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//if (col == null) return false;
|
||||||
|
|
||||||
|
if (col.Count == 0) return false;
|
||||||
|
|
||||||
// Fail out if the column isn't tall enough
|
// Fail out if the column isn't tall enough
|
||||||
if (col.Count < y)
|
if (y >= col.Count)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ti = col[y];
|
ti = col[y];
|
||||||
|
@ -238,6 +249,21 @@ public class BoardState {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extremely bad allocation heavy string dump of the board state
|
||||||
|
public override string ToString() {
|
||||||
|
var str = base.ToString();
|
||||||
|
str += "\n";
|
||||||
|
foreach(TileStack ts in state) {
|
||||||
|
foreach(TileInfo ti in ts) {
|
||||||
|
// Why are enums so shiiiiit
|
||||||
|
str += System.Enum.GetName(typeof(TileColor),ti.color) + "(" + ti.data + "), ";
|
||||||
|
}
|
||||||
|
str += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a copy of a column
|
// Create a copy of a column
|
||||||
TileStack Copy(TileStack ts) {
|
TileStack Copy(TileStack ts) {
|
||||||
var intform = ts.Select(tile => (int)tile);
|
var intform = ts.Select(tile => (int)tile);
|
||||||
|
|
|
@ -2,17 +2,108 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class GameBoardDrawer : MonoBehaviour
|
using System.Linq;
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
[ExecuteAlways]
|
||||||
void Update()
|
public class GameBoardDrawer : MonoBehaviour {
|
||||||
{
|
public GameObject TilePrefab;
|
||||||
|
bool ValidatePrefab() {
|
||||||
}
|
if (!TilePrefab) {
|
||||||
|
TilePrefab = Resources.Load<GameObject>("TilePrefab");
|
||||||
|
}
|
||||||
|
return TilePrefab;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cached reference to the gameboard
|
||||||
|
GameBoard _gameBoard;
|
||||||
|
public GameBoard gameBoard {
|
||||||
|
get {
|
||||||
|
if (_gameBoard) return _gameBoard;
|
||||||
|
return _gameBoard = GetComponent<GameBoard>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoardState boardState {
|
||||||
|
get {
|
||||||
|
if (gameBoard) return gameBoard.board;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<List<TileDrawer>> TileDrawers;
|
||||||
|
|
||||||
|
public float TileSize = 0.5f;
|
||||||
|
|
||||||
|
void ValidateDrawers() {
|
||||||
|
if (TileDrawers == null) {
|
||||||
|
ClearDrawers();
|
||||||
|
|
||||||
|
Transform self = transform; // Cache
|
||||||
|
// Setup the board
|
||||||
|
// Board is arranged as a series of column 'stacks', bottom up
|
||||||
|
TileDrawers = new List<List<TileDrawer>>();
|
||||||
|
for (int x = 0; x < BoardState.BoardWidth; ++x) {
|
||||||
|
var col = new List<TileDrawer>();
|
||||||
|
for (int y = 0; y < BoardState.BoardHeight; ++y) {
|
||||||
|
var tile = Instantiate<GameObject>(TilePrefab,self);
|
||||||
|
|
||||||
|
tile.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
||||||
|
// placement is handled in the update section
|
||||||
|
//var tileT = tile.transform;
|
||||||
|
//tileT.localPosition = new Vector3(x, y) * TileSize;
|
||||||
|
|
||||||
|
col.Add(tile.GetComponent<TileDrawer>());
|
||||||
|
}
|
||||||
|
TileDrawers.Add(col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateDrawers() {
|
||||||
|
if (TileDrawers == null) return;
|
||||||
|
|
||||||
|
for (int x = 0; x < TileDrawers.Count; ++x) {
|
||||||
|
var col = TileDrawers[x];
|
||||||
|
for (int y = 0; y < col.Count; ++y) {
|
||||||
|
var tile = col[y];
|
||||||
|
|
||||||
|
var tileT = tile.transform;
|
||||||
|
tileT.localPosition = new Vector3(x, y) * TileSize;
|
||||||
|
if (boardState.TileAt(x, y,out TileInfo ti)) {
|
||||||
|
tile.toDraw = ti;
|
||||||
|
} else {
|
||||||
|
tile.toDraw = TileInfo.Air;
|
||||||
|
}
|
||||||
|
|
||||||
|
//tile.toDraw =
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ContextMenu("Clear Drawers")]
|
||||||
|
void ClearDrawers() {
|
||||||
|
// Select all gameObjects in the TileDrawer list flattened to a enumerator
|
||||||
|
/*var flat = TileDrawers.SelectMany(tdl => tdl.Select(td=>td.gameObject));
|
||||||
|
foreach(var tileDrawingGameObject in flat) {
|
||||||
|
DestroyImmediate(tileDrawingGameObject);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Redundant purge
|
||||||
|
var children = GetComponentsInChildren<TileDrawer>();
|
||||||
|
foreach(var td in children) {
|
||||||
|
DestroyImmediate(td.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update() {
|
||||||
|
// Can't proceed with an invalid prefab, exit early
|
||||||
|
if (!ValidatePrefab()) return;
|
||||||
|
|
||||||
|
if (boardState == null) return; // Skip empty boards
|
||||||
|
|
||||||
|
ValidatePrefab();
|
||||||
|
ValidateDrawers();
|
||||||
|
|
||||||
|
UpdateDrawers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,268 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 3
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 11
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 0
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_UseShadowmask: 1
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &20737161
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 20737164}
|
||||||
|
- component: {fileID: 20737163}
|
||||||
|
- component: {fileID: 20737162}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Testboard
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &20737162
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 20737161}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 30516090f4fb2954fba121c0dfdfe3ea, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
TilePrefab: {fileID: 6929433238081324627, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
|
type: 3}
|
||||||
|
TileSize: 0.5
|
||||||
|
--- !u!114 &20737163
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 20737161}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d402e786b88425242825f7fe22d84afb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
EntityID: 0
|
||||||
|
authorityID: -1
|
||||||
|
Options: 01020304
|
||||||
|
--- !u!4 &20737164
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 20737161}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 3.2397764, y: -0.9145438, z: -2.6045513}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1062404885
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1062404888}
|
||||||
|
- component: {fileID: 1062404887}
|
||||||
|
- component: {fileID: 1062404886}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!81 &1062404886
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1062404885}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!20 &1062404887
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1062404885}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 1
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &1062404888
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1062404885}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 2.2195444, y: 6.629975, z: -16.29866}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b54580589a1c73b4192584a8781c0d51
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -215,7 +215,8 @@ PrefabInstance:
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Sprite
|
propertyPath: m_Sprite
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 6097206691055106581, guid: ba7046a7d637abc4ba486e3e9e4fcfd3,
|
||||||
|
type: 3}
|
||||||
- target: {fileID: 6929433238081324624, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324624, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Color.a
|
propertyPath: m_Color.a
|
||||||
|
@ -224,12 +225,12 @@ PrefabInstance:
|
||||||
- target: {fileID: 6929433238081324624, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324624, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_WasSpriteAssigned
|
propertyPath: m_WasSpriteAssigned
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: color
|
propertyPath: color
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
@ -244,7 +245,7 @@ PrefabInstance:
|
||||||
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: toDraw.data
|
propertyPath: toDraw.data
|
||||||
value: 1
|
value: 257
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
- target: {fileID: 6929433238081324625, guid: 2d35555d89dd5e94fb9527d52c616c11,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TileDrawer : MonoBehaviour {
|
||||||
var sr = GetComponent<SpriteRenderer>(); // sprite renderer cache
|
var sr = GetComponent<SpriteRenderer>(); // sprite renderer cache
|
||||||
|
|
||||||
var subRenderer = new GameObject("Underlay Drawer", typeof(SpriteRenderer));
|
var subRenderer = new GameObject("Underlay Drawer", typeof(SpriteRenderer));
|
||||||
subRenderer.hideFlags = HideFlags.DontSave;
|
subRenderer.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
||||||
|
|
||||||
subRenderer.transform.SetParent(transform, false); // Direct parent, literal transform setup
|
subRenderer.transform.SetParent(transform, false); // Direct parent, literal transform setup
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class TileDrawer : MonoBehaviour {
|
||||||
var sr = GetComponent<SpriteRenderer>();
|
var sr = GetComponent<SpriteRenderer>();
|
||||||
for (int i = 0; i < SmearSteps; ++i) {
|
for (int i = 0; i < SmearSteps; ++i) {
|
||||||
var smearRenderer = new GameObject(string.Format("Smear {0}", i));
|
var smearRenderer = new GameObject(string.Format("Smear {0}", i));
|
||||||
smearRenderer.hideFlags = HideFlags.HideAndDontSave;
|
smearRenderer.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.HideInHierarchy;
|
||||||
|
|
||||||
smearRenderer.transform.SetParent(transform,false);
|
smearRenderer.transform.SetParent(transform,false);
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ public class TileDrawer : MonoBehaviour {
|
||||||
// Cool ramp
|
// Cool ramp
|
||||||
layerOpacity *= layerOpacity;
|
layerOpacity *= layerOpacity;
|
||||||
|
|
||||||
|
|
||||||
layer.color = new Color(1, 1, 1, layerOpacity);
|
layer.color = new Color(1, 1, 1, layerOpacity);
|
||||||
|
|
||||||
layer.enabled = layerOpacity > Mathf.Epsilon && SmearDistance > 0;
|
layer.enabled = layerOpacity > Mathf.Epsilon && SmearDistance > 0;
|
||||||
|
@ -113,7 +112,7 @@ public class TileDrawer : MonoBehaviour {
|
||||||
var sr = GetComponent<SpriteRenderer>(); // sprite renderer cache
|
var sr = GetComponent<SpriteRenderer>(); // sprite renderer cache
|
||||||
|
|
||||||
var subRenderer = new GameObject("Overlay Drawer", typeof(SpriteRenderer));
|
var subRenderer = new GameObject("Overlay Drawer", typeof(SpriteRenderer));
|
||||||
subRenderer.hideFlags = HideFlags.DontSave;
|
subRenderer.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor; ;
|
||||||
|
|
||||||
subRenderer.transform.SetParent(transform, false); // Direct parent, literal transform setup
|
subRenderer.transform.SetParent(transform, false); // Direct parent, literal transform setup
|
||||||
|
|
||||||
|
@ -135,7 +134,6 @@ public class TileDrawer : MonoBehaviour {
|
||||||
if (Overlay) Overlay.color = color;
|
if (Overlay) Overlay.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO Add wildcard Mystery Spark handlers
|
// TODO Add wildcard Mystery Spark handlers
|
||||||
void Update() {
|
void Update() {
|
||||||
if (!tsi) return;
|
if (!tsi) return;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8c3256d7fa85ac9488ad5926ec428a45
|
guid: 13773788df82078448a368e2f619dc31
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
|
@ -46,12 +46,14 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
tsi: {fileID: 11400000, guid: 18b884ffdbcbecd489662f53d8e1b44d, type: 2}
|
tsi: {fileID: 11400000, guid: 18b884ffdbcbecd489662f53d8e1b44d, type: 2}
|
||||||
toDraw:
|
toDraw:
|
||||||
data: 800
|
data: 257
|
||||||
detail: 32
|
detail: 1
|
||||||
color: 3
|
color: 1
|
||||||
stackedBelow: 0
|
stackedBelow: 0
|
||||||
amountInStack: 0
|
amountInStack: 0
|
||||||
opacity: 0.251
|
opacity: 1
|
||||||
|
smearOpacity: 0
|
||||||
|
SmearDistance: 1
|
||||||
--- !u!212 &6929433238081324624
|
--- !u!212 &6929433238081324624
|
||||||
SpriteRenderer:
|
SpriteRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
Loading…
Reference in New Issue