Create All Needed Scripts
This commit is contained in:
50
Assets/Prefabs/RootLifetimeScope.prefab
Normal file
50
Assets/Prefabs/RootLifetimeScope.prefab
Normal file
@@ -0,0 +1,50 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &8304424163596944933
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5754733557323264208}
|
||||
- component: {fileID: 7273189601935488900}
|
||||
m_Layer: 0
|
||||
m_Name: RootLifetimeScope
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5754733557323264208
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8304424163596944933}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 4.9901776, y: 3.4106257, z: -0.04203772}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &7273189601935488900
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8304424163596944933}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31d874275d6f4540a21f512df426fa88, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
parentReference:
|
||||
TypeName:
|
||||
autoRun: 1
|
||||
autoInjectGameObjects: []
|
||||
7
Assets/Prefabs/RootLifetimeScope.prefab.meta
Normal file
7
Assets/Prefabs/RootLifetimeScope.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 520a563433527df408515da372ea797f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1048
Assets/Scenes/Scene_Submission.unity
Normal file
1048
Assets/Scenes/Scene_Submission.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Scene_Submission.unity.meta
Normal file
7
Assets/Scenes/Scene_Submission.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6202ed78c922cf47bf0ea38f735a1bd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/Scripts/Enums.meta
Normal file
3
Assets/Scripts/Enums.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f519e21b55b24d3dab3c35c228057972
|
||||
timeCreated: 1765661373
|
||||
15
Assets/Scripts/Enums/Enums.cs
Normal file
15
Assets/Scripts/Enums/Enums.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Enums {
|
||||
public enum GemType{
|
||||
Blue,
|
||||
Green,
|
||||
Red,
|
||||
Yellow,
|
||||
Purple,
|
||||
Bomb
|
||||
}
|
||||
|
||||
public enum GameState {
|
||||
Wait,
|
||||
Move
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Enums/Enums.cs.meta
Normal file
3
Assets/Scripts/Enums/Enums.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 827aa06575984dfaa4234fca3fb70532
|
||||
timeCreated: 1765661384
|
||||
@@ -2,16 +2,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Enums;
|
||||
|
||||
//Done, moved to MatchService and GameBoard
|
||||
public class GameBoard
|
||||
{
|
||||
// - sets size of the grid
|
||||
// - handles the score
|
||||
// - holds the current matches
|
||||
#region Variables
|
||||
|
||||
private int height = 0;
|
||||
public int Height { get { return height; } }
|
||||
public int Height { get { return this.height; } }
|
||||
|
||||
private int width = 0;
|
||||
public int Width { get { return width; } }
|
||||
public int Width { get { return this.width; } }
|
||||
|
||||
private SC_Gem[,] allGems;
|
||||
// public Gem[,] AllGems { get { return allGems; } }
|
||||
@@ -19,62 +24,68 @@ public class GameBoard
|
||||
private int score = 0;
|
||||
public int Score
|
||||
{
|
||||
get { return score; }
|
||||
set { score = value; }
|
||||
get { return this.score; }
|
||||
set {
|
||||
this.score = value; }
|
||||
}
|
||||
|
||||
private List<SC_Gem> currentMatches = new List<SC_Gem>();
|
||||
public List<SC_Gem> CurrentMatches { get { return currentMatches; } }
|
||||
public List<SC_Gem> CurrentMatches { get { return this.currentMatches; } }
|
||||
#endregion
|
||||
|
||||
public GameBoard(int _Width, int _Height)
|
||||
{
|
||||
height = _Height;
|
||||
width = _Width;
|
||||
allGems = new SC_Gem[width, height];
|
||||
this.height = _Height;
|
||||
this.width = _Width;
|
||||
this.allGems = new SC_Gem[this.width, this.height];
|
||||
}
|
||||
|
||||
//checks if there are 3 gems of the same type next to each other
|
||||
//used during setup to avoid matches on game start
|
||||
//MatchService
|
||||
public bool MatchesAt(Vector2Int _PositionToCheck, SC_Gem _GemToCheck)
|
||||
{
|
||||
if (_PositionToCheck.x > 1)
|
||||
{
|
||||
if (allGems[_PositionToCheck.x - 1, _PositionToCheck.y].type == _GemToCheck.type &&
|
||||
allGems[_PositionToCheck.x - 2, _PositionToCheck.y].type == _GemToCheck.type)
|
||||
if (this.allGems[_PositionToCheck.x - 1, _PositionToCheck.y].type == _GemToCheck.type && this.allGems[_PositionToCheck.x - 2, _PositionToCheck.y].type == _GemToCheck.type)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_PositionToCheck.y > 1)
|
||||
{
|
||||
if (allGems[_PositionToCheck.x, _PositionToCheck.y - 1].type == _GemToCheck.type &&
|
||||
allGems[_PositionToCheck.x, _PositionToCheck.y - 2].type == _GemToCheck.type)
|
||||
if (this.allGems[_PositionToCheck.x, _PositionToCheck.y - 1].type == _GemToCheck.type && this.allGems[_PositionToCheck.x, _PositionToCheck.y - 2].type == _GemToCheck.type)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//places the gem in the 2d array
|
||||
public void SetGem(int _X, int _Y, SC_Gem _Gem)
|
||||
{
|
||||
allGems[_X, _Y] = _Gem;
|
||||
this.allGems[_X, _Y] = _Gem;
|
||||
}
|
||||
|
||||
public SC_Gem GetGem(int _X,int _Y)
|
||||
{
|
||||
return allGems[_X, _Y];
|
||||
return this.allGems[_X, _Y];
|
||||
}
|
||||
|
||||
//MatchService
|
||||
public void FindAllMatches()
|
||||
{
|
||||
currentMatches.Clear();
|
||||
this.currentMatches.Clear();
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
for (int y = 0; y < height; y++)
|
||||
for (int x = 0; x < this.width; x++)
|
||||
for (int y = 0; y < this.height; y++)
|
||||
{
|
||||
SC_Gem currentGem = allGems[x, y];
|
||||
SC_Gem currentGem = this.allGems[x, y];
|
||||
if (currentGem != null)
|
||||
{
|
||||
if (x > 0 && x < width - 1)
|
||||
if (x > 0 && x < this.width - 1)
|
||||
{
|
||||
SC_Gem leftGem = allGems[x - 1, y];
|
||||
SC_Gem rightGem = allGems[x + 1, y];
|
||||
SC_Gem leftGem = this.allGems[x - 1, y];
|
||||
SC_Gem rightGem = this.allGems[x + 1, y];
|
||||
//checking no empty spots
|
||||
if (leftGem != null && rightGem != null)
|
||||
{
|
||||
@@ -84,17 +95,17 @@ public class GameBoard
|
||||
currentGem.isMatch = true;
|
||||
leftGem.isMatch = true;
|
||||
rightGem.isMatch = true;
|
||||
currentMatches.Add(currentGem);
|
||||
currentMatches.Add(leftGem);
|
||||
currentMatches.Add(rightGem);
|
||||
this.currentMatches.Add(currentGem);
|
||||
this.currentMatches.Add(leftGem);
|
||||
this.currentMatches.Add(rightGem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (y > 0 && y < height - 1)
|
||||
if (y > 0 && y < this.height - 1)
|
||||
{
|
||||
SC_Gem aboveGem = allGems[x, y - 1];
|
||||
SC_Gem bellowGem = allGems[x, y + 1];
|
||||
SC_Gem aboveGem = this.allGems[x, y - 1];
|
||||
SC_Gem bellowGem = this.allGems[x, y + 1];
|
||||
//checking no empty spots
|
||||
if (aboveGem != null && bellowGem != null)
|
||||
{
|
||||
@@ -104,51 +115,50 @@ public class GameBoard
|
||||
currentGem.isMatch = true;
|
||||
aboveGem.isMatch = true;
|
||||
bellowGem.isMatch = true;
|
||||
currentMatches.Add(currentGem);
|
||||
currentMatches.Add(aboveGem);
|
||||
currentMatches.Add(bellowGem);
|
||||
this.currentMatches.Add(currentGem);
|
||||
this.currentMatches.Add(aboveGem);
|
||||
this.currentMatches.Add(bellowGem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentMatches.Count > 0)
|
||||
currentMatches = currentMatches.Distinct().ToList();
|
||||
if (this.currentMatches.Count > 0) this.currentMatches = this.currentMatches.Distinct().ToList();
|
||||
|
||||
CheckForBombs();
|
||||
}
|
||||
|
||||
public void CheckForBombs()
|
||||
{
|
||||
for (int i = 0; i < currentMatches.Count; i++)
|
||||
for (int i = 0; i < this.currentMatches.Count; i++)
|
||||
{
|
||||
SC_Gem gem = currentMatches[i];
|
||||
SC_Gem gem = this.currentMatches[i];
|
||||
int x = gem.posIndex.x;
|
||||
int y = gem.posIndex.y;
|
||||
|
||||
if (gem.posIndex.x > 0)
|
||||
{
|
||||
if (allGems[x - 1, y] != null && allGems[x - 1, y].type == GlobalEnums.GemType.bomb)
|
||||
MarkBombArea(new Vector2Int(x - 1, y), allGems[x - 1, y].blastSize);
|
||||
if (this.allGems[x - 1, y] != null && this.allGems[x - 1, y].type == GemType.Bomb)
|
||||
MarkBombArea(new Vector2Int(x - 1, y), this.allGems[x - 1, y].blastSize);
|
||||
}
|
||||
|
||||
if (gem.posIndex.x + 1 < width)
|
||||
if (gem.posIndex.x + 1 < this.width)
|
||||
{
|
||||
if (allGems[x + 1, y] != null && allGems[x + 1, y].type == GlobalEnums.GemType.bomb)
|
||||
MarkBombArea(new Vector2Int(x + 1, y), allGems[x + 1, y].blastSize);
|
||||
if (this.allGems[x + 1, y] != null && this.allGems[x + 1, y].type == GemType.Bomb)
|
||||
MarkBombArea(new Vector2Int(x + 1, y), this.allGems[x + 1, y].blastSize);
|
||||
}
|
||||
|
||||
if (gem.posIndex.y > 0)
|
||||
{
|
||||
if (allGems[x, y - 1] != null && allGems[x, y - 1].type == GlobalEnums.GemType.bomb)
|
||||
MarkBombArea(new Vector2Int(x, y - 1), allGems[x, y - 1].blastSize);
|
||||
if (this.allGems[x, y - 1] != null && this.allGems[x, y - 1].type == GemType.Bomb)
|
||||
MarkBombArea(new Vector2Int(x, y - 1), this.allGems[x, y - 1].blastSize);
|
||||
}
|
||||
|
||||
if (gem.posIndex.y + 1 < height)
|
||||
if (gem.posIndex.y + 1 < this.height)
|
||||
{
|
||||
if (allGems[x, y + 1] != null && allGems[x, y + 1].type == GlobalEnums.GemType.bomb)
|
||||
MarkBombArea(new Vector2Int(x, y + 1), allGems[x, y + 1].blastSize);
|
||||
if (this.allGems[x, y + 1] != null && this.allGems[x, y + 1].type == GemType.Bomb)
|
||||
MarkBombArea(new Vector2Int(x, y + 1), this.allGems[x, y + 1].blastSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,18 +170,19 @@ public class GameBoard
|
||||
{
|
||||
for (int y = bombPos.y - _BlastSize; y <= bombPos.y + _BlastSize; y++)
|
||||
{
|
||||
if (x >= 0 && x < width && y >= 0 && y < height)
|
||||
if (x >= 0 && x < this.width && y >= 0 && y < this.height)
|
||||
{
|
||||
if (allGems[x, y] != null)
|
||||
if (this.allGems[x, y] != null)
|
||||
{
|
||||
_print += "(" + x + "," + y + ")" + System.Environment.NewLine;
|
||||
allGems[x, y].isMatch = true;
|
||||
currentMatches.Add(allGems[x, y]);
|
||||
this.allGems[x, y].isMatch = true;
|
||||
this.currentMatches.Add(this.allGems[x, y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
currentMatches = currentMatches.Distinct().ToList();
|
||||
|
||||
this.currentMatches = this.currentMatches.Distinct().ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GlobalEnums : MonoBehaviour
|
||||
{
|
||||
public enum GemType { blue, green, red, yellow, purple, bomb };
|
||||
public enum GameState { wait, move }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9f1d6e2be833b1469e3565a3c5290af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/Scripts/Models.meta
Normal file
3
Assets/Scripts/Models.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f5c654abc6e4144ab16f8419579ee78
|
||||
timeCreated: 1765649284
|
||||
27
Assets/Scripts/Models/GameBoard.cs
Normal file
27
Assets/Scripts/Models/GameBoard.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Models.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Services {
|
||||
public class GameBoard : IGameBoard {
|
||||
private int height, width;
|
||||
public int Height => this.height;
|
||||
public int Width => this.width;
|
||||
private Gem[,] gemsGrid;
|
||||
public Gem[,] GemsGrid => this.gemsGrid;
|
||||
|
||||
public GameBoard(int width, int height) {
|
||||
this.height = height;
|
||||
this.width = width;
|
||||
this.gemsGrid = new Gem[width, height];
|
||||
}
|
||||
|
||||
public Gem GetGemAt(Vector2Int pos) {
|
||||
Gem gameObject = this.gemsGrid[pos.x, pos.y];
|
||||
return gameObject != null ? gameObject : null;
|
||||
}
|
||||
|
||||
public void SetGemAt(Vector2Int pos, Gem gameObject) {
|
||||
this.gemsGrid[pos.x, pos.y] = gameObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Models/GameBoard.cs.meta
Normal file
3
Assets/Scripts/Models/GameBoard.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a1125aa75474479a9ca0d8de4f6887c
|
||||
timeCreated: 1765644440
|
||||
26
Assets/Scripts/Models/Gem.cs
Normal file
26
Assets/Scripts/Models/Gem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Enums;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Services {
|
||||
public class Gem {
|
||||
private GemType type;
|
||||
private Vector2Int position;
|
||||
|
||||
public GemType Type => this.type;
|
||||
public Vector2Int Position => this.position;
|
||||
|
||||
private int scoreValue;
|
||||
public int ScoreValue => this.scoreValue;
|
||||
|
||||
public bool isMatch = false;
|
||||
|
||||
public Gem(GemType type, Vector2Int position) {
|
||||
this.type = type;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public void SetPosition(Vector2Int position) {
|
||||
this.position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Models/Gem.cs.meta
Normal file
3
Assets/Scripts/Models/Gem.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3821a37fdec454f999de640213aa95e
|
||||
timeCreated: 1765649448
|
||||
3
Assets/Scripts/Models/Interfaces.meta
Normal file
3
Assets/Scripts/Models/Interfaces.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a806e20251e7471e8b7fd9d80c7d95a6
|
||||
timeCreated: 1765649292
|
||||
12
Assets/Scripts/Models/Interfaces/IGameBoard.cs
Normal file
12
Assets/Scripts/Models/Interfaces/IGameBoard.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Services;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Models.Interfaces {
|
||||
public interface IGameBoard {
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
Gem[,] GemsGrid { get; }
|
||||
Gem GetGemAt(Vector2Int pos);
|
||||
void SetGemAt(Vector2Int pos, Gem gameObject);
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Models/Interfaces/IGameBoard.cs.meta
Normal file
3
Assets/Scripts/Models/Interfaces/IGameBoard.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83a1cf6a985d4d7092f2fc9044fbab8c
|
||||
timeCreated: 1765632691
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GO_Gem : MonoBehaviour {
|
||||
private Rigidbody rigidBody;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
this.rigidBody = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
public void Spawn() {
|
||||
this.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Return() {
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 247ae442234d0de449a27a3ac5d46cf4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,15 +2,16 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Enums;
|
||||
|
||||
public class SC_GameLogic : MonoBehaviour
|
||||
{
|
||||
private Dictionary<string, GameObject> unityObjects;
|
||||
private int score = 0;
|
||||
private float displayScore = 0;
|
||||
private GameBoard gameBoard;
|
||||
private GlobalEnums.GameState currentState = GlobalEnums.GameState.move;
|
||||
public GlobalEnums.GameState CurrentState { get { return currentState; } }
|
||||
private Dictionary<string, GameObject> unityObjects; //this is a dictionary of all game objects in the scene
|
||||
private int score = 0; //current score
|
||||
private float displayScore = 0; //for animation, i think
|
||||
private GameBoard gameBoard; //game board object
|
||||
private GameState currentState = GameState.Move; //current game state
|
||||
public GameState CurrentState { get { return this.currentState; } }
|
||||
|
||||
#region MonoBehaviour
|
||||
private void Awake()
|
||||
@@ -25,36 +26,37 @@ public class SC_GameLogic : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
displayScore = Mathf.Lerp(displayScore, gameBoard.Score, SC_GameVariables.Instance.scoreSpeed * Time.deltaTime);
|
||||
unityObjects["Txt_Score"].GetComponent<TMPro.TextMeshProUGUI>().text = displayScore.ToString("0");
|
||||
this.displayScore = Mathf.Lerp(this.displayScore, this.gameBoard.Score, SC_GameVariables.Instance.scoreSpeed * Time.deltaTime);
|
||||
this.unityObjects["Txt_Score"].GetComponent<TMPro.TextMeshProUGUI>().text = this.displayScore.ToString("0");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Logic
|
||||
private void Init()
|
||||
{
|
||||
unityObjects = new Dictionary<string, GameObject>();
|
||||
this.unityObjects = new Dictionary<string, GameObject>();
|
||||
GameObject[] _obj = GameObject.FindGameObjectsWithTag("UnityObject");
|
||||
foreach (GameObject g in _obj)
|
||||
unityObjects.Add(g.name,g);
|
||||
foreach (GameObject g in _obj) this.unityObjects.Add(g.name,g);
|
||||
|
||||
gameBoard = new GameBoard(7, 7);
|
||||
this.gameBoard = new GameBoard(7, 7);
|
||||
Setup();
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
private void Setup()
|
||||
{
|
||||
for (int x = 0; x < gameBoard.Width; x++)
|
||||
for (int y = 0; y < gameBoard.Height; y++)
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Vector2 _pos = new Vector2(x, y);
|
||||
GameObject _bgTile = Instantiate(SC_GameVariables.Instance.bgTilePrefabs, _pos, Quaternion.identity);
|
||||
_bgTile.transform.SetParent(unityObjects["GemsHolder"].transform);
|
||||
_bgTile.transform.SetParent(this.unityObjects["GemsHolder"].transform);
|
||||
_bgTile.name = "BG Tile - " + x + ", " + y;
|
||||
|
||||
int _gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length);
|
||||
|
||||
int iterations = 0;
|
||||
while (gameBoard.MatchesAt(new Vector2Int(x, y), SC_GameVariables.Instance.gems[_gemToUse]) && iterations < 100)
|
||||
while (this.gameBoard.MatchesAt(new Vector2Int(x, y), SC_GameVariables.Instance.gems[_gemToUse]) && iterations < 100)
|
||||
{
|
||||
_gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length);
|
||||
iterations++;
|
||||
@@ -64,52 +66,64 @@ public class SC_GameLogic : MonoBehaviour
|
||||
}
|
||||
public void StartGame()
|
||||
{
|
||||
unityObjects["Txt_Score"].GetComponent<TextMeshProUGUI>().text = score.ToString("0");
|
||||
this.unityObjects["Txt_Score"].GetComponent<TextMeshProUGUI>().text = this.score.ToString("0");
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
private void SpawnGem(Vector2Int _Position, SC_Gem _GemToSpawn)
|
||||
{
|
||||
if (Random.Range(0, 100f) < SC_GameVariables.Instance.bombChance)
|
||||
_GemToSpawn = SC_GameVariables.Instance.bomb;
|
||||
|
||||
SC_Gem _gem = Instantiate(_GemToSpawn, new Vector3(_Position.x, _Position.y + SC_GameVariables.Instance.dropHeight, 0f), Quaternion.identity);
|
||||
_gem.transform.SetParent(unityObjects["GemsHolder"].transform);
|
||||
_gem.transform.SetParent(this.unityObjects["GemsHolder"].transform);
|
||||
_gem.name = "Gem - " + _Position.x + ", " + _Position.y;
|
||||
gameBoard.SetGem(_Position.x,_Position.y, _gem);
|
||||
this.gameBoard.SetGem(_Position.x,_Position.y, _gem);
|
||||
_gem.SetupGem(this,_Position);
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
public void SetGem(int _X,int _Y, SC_Gem _Gem)
|
||||
{
|
||||
gameBoard.SetGem(_X,_Y, _Gem);
|
||||
this.gameBoard.SetGem(_X,_Y, _Gem);
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
public SC_Gem GetGem(int _X, int _Y)
|
||||
{
|
||||
return gameBoard.GetGem(_X, _Y);
|
||||
return this.gameBoard.GetGem(_X, _Y);
|
||||
}
|
||||
public void SetState(GlobalEnums.GameState _CurrentState)
|
||||
public void SetState(GameState _CurrentState)
|
||||
{
|
||||
currentState = _CurrentState;
|
||||
this.currentState = _CurrentState;
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
public void DestroyMatches()
|
||||
{
|
||||
for (int i = 0; i < gameBoard.CurrentMatches.Count; i++)
|
||||
if (gameBoard.CurrentMatches[i] != null)
|
||||
for (int i = 0; i < this.gameBoard.CurrentMatches.Count; i++)
|
||||
if (this.gameBoard.CurrentMatches[i] != null)
|
||||
{
|
||||
ScoreCheck(gameBoard.CurrentMatches[i]);
|
||||
DestroyMatchedGemsAt(gameBoard.CurrentMatches[i].posIndex);
|
||||
ScoreCheck(this.gameBoard.CurrentMatches[i]);
|
||||
DestroyMatchedGemsAt(this.gameBoard.CurrentMatches[i].posIndex);
|
||||
}
|
||||
|
||||
StartCoroutine(DecreaseRowCo());
|
||||
}
|
||||
|
||||
//I think, this moves gems down after a match?
|
||||
//MoveGemsDown
|
||||
//GameBoardService
|
||||
private IEnumerator DecreaseRowCo()
|
||||
{
|
||||
yield return new WaitForSeconds(.2f);
|
||||
|
||||
int nullCounter = 0;
|
||||
for (int x = 0; x < gameBoard.Width; x++)
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < gameBoard.Height; y++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
SC_Gem _curGem = gameBoard.GetGem(x, y);
|
||||
SC_Gem _curGem = this.gameBoard.GetGem(x, y);
|
||||
if (_curGem == null)
|
||||
{
|
||||
nullCounter++;
|
||||
@@ -127,13 +141,16 @@ public class SC_GameLogic : MonoBehaviour
|
||||
StartCoroutine(FilledBoardCo());
|
||||
}
|
||||
|
||||
//IScoreService
|
||||
public void ScoreCheck(SC_Gem gemToCheck)
|
||||
{
|
||||
gameBoard.Score += gemToCheck.scoreValue;
|
||||
this.gameBoard.Score += gemToCheck.scoreValue;
|
||||
}
|
||||
|
||||
//GameBoardService - DestroyMatchedGems
|
||||
private void DestroyMatchedGemsAt(Vector2Int _Pos)
|
||||
{
|
||||
SC_Gem _curGem = gameBoard.GetGem(_Pos.x,_Pos.y);
|
||||
SC_Gem _curGem = this.gameBoard.GetGem(_Pos.x,_Pos.y);
|
||||
if (_curGem != null)
|
||||
{
|
||||
Instantiate(_curGem.destroyEffect, new Vector2(_Pos.x, _Pos.y), Quaternion.identity);
|
||||
@@ -142,14 +159,16 @@ public class SC_GameLogic : MonoBehaviour
|
||||
SetGem(_Pos.x,_Pos.y, null);
|
||||
}
|
||||
}
|
||||
|
||||
//GameBoardService - FillBoard
|
||||
|
||||
private IEnumerator FilledBoardCo()
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
RefillBoard();
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
gameBoard.FindAllMatches();
|
||||
if (gameBoard.CurrentMatches.Count > 0)
|
||||
this.gameBoard.FindAllMatches();
|
||||
if (this.gameBoard.CurrentMatches.Count > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
DestroyMatches();
|
||||
@@ -157,16 +176,18 @@ public class SC_GameLogic : MonoBehaviour
|
||||
else
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
currentState = GlobalEnums.GameState.move;
|
||||
this.currentState = GameState.Move;
|
||||
}
|
||||
}
|
||||
|
||||
//GameBoardService
|
||||
private void RefillBoard()
|
||||
{
|
||||
for (int x = 0; x < gameBoard.Width; x++)
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < gameBoard.Height; y++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
SC_Gem _curGem = gameBoard.GetGem(x,y);
|
||||
SC_Gem _curGem = this.gameBoard.GetGem(x,y);
|
||||
if (_curGem == null)
|
||||
{
|
||||
int gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length);
|
||||
@@ -176,15 +197,17 @@ public class SC_GameLogic : MonoBehaviour
|
||||
}
|
||||
CheckMisplacedGems();
|
||||
}
|
||||
//gets all gem game objects
|
||||
//if the gem is not in GameBoard, destroy it
|
||||
private void CheckMisplacedGems()
|
||||
{
|
||||
List<SC_Gem> foundGems = new List<SC_Gem>();
|
||||
foundGems.AddRange(FindObjectsOfType<SC_Gem>());
|
||||
for (int x = 0; x < gameBoard.Width; x++)
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < gameBoard.Height; y++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
SC_Gem _curGem = gameBoard.GetGem(x, y);
|
||||
SC_Gem _curGem = this.gameBoard.GetGem(x, y);
|
||||
if (foundGems.Contains(_curGem))
|
||||
foundGems.Remove(_curGem);
|
||||
}
|
||||
@@ -195,7 +218,7 @@ public class SC_GameLogic : MonoBehaviour
|
||||
}
|
||||
public void FindAllMatches()
|
||||
{
|
||||
gameBoard.FindAllMatches();
|
||||
this.gameBoard.FindAllMatches();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
//Done
|
||||
//This is basically just the settings, this can maybe be a ScriptableObject
|
||||
public class SC_GameVariables : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Enums;
|
||||
using UnityEngine;
|
||||
|
||||
//This is a SINGULAR gem
|
||||
@@ -14,7 +15,7 @@ public class SC_Gem : MonoBehaviour
|
||||
private float swipeAngle = 0;
|
||||
private SC_Gem otherGem;
|
||||
|
||||
public GlobalEnums.GemType type;
|
||||
public GemType type;
|
||||
public bool isMatch = false;
|
||||
private Vector2Int previousPos;
|
||||
public GameObject destroyEffect;
|
||||
@@ -25,19 +26,22 @@ public class SC_Gem : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Vector2.Distance(transform.position, posIndex) > 0.01f)
|
||||
transform.position = Vector2.Lerp(transform.position, posIndex, SC_GameVariables.Instance.gemSpeed * Time.deltaTime);
|
||||
//if the current position doesnt match the index in GameBoard, animate it to move to the correct position
|
||||
//else, we update the GameBoard with the current possition, do we need this every frame????
|
||||
if (Vector2.Distance(this.transform.position, this.posIndex) > 0.01f)
|
||||
this.transform.position = Vector2.Lerp(this.transform.position, this.posIndex, SC_GameVariables.Instance.gemSpeed * Time.deltaTime);
|
||||
else
|
||||
{
|
||||
transform.position = new Vector3(posIndex.x, posIndex.y, 0);
|
||||
scGameLogic.SetGem(posIndex.x, posIndex.y, this);
|
||||
this.transform.position = new Vector3(this.posIndex.x, this.posIndex.y, 0);
|
||||
this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this);
|
||||
}
|
||||
if (mousePressed && Input.GetMouseButtonUp(0))
|
||||
|
||||
if (this.mousePressed && Input.GetMouseButtonUp(0))
|
||||
{
|
||||
mousePressed = false;
|
||||
if (scGameLogic.CurrentState == GlobalEnums.GameState.move)
|
||||
this.mousePressed = false;
|
||||
if (this.scGameLogic.CurrentState == GameState.Move)
|
||||
{
|
||||
finalTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
this.finalTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
CalculateAngle();
|
||||
}
|
||||
}
|
||||
@@ -45,63 +49,63 @@ public class SC_Gem : MonoBehaviour
|
||||
|
||||
public void SetupGem(SC_GameLogic _ScGameLogic,Vector2Int _Position)
|
||||
{
|
||||
posIndex = _Position;
|
||||
scGameLogic = _ScGameLogic;
|
||||
this.posIndex = _Position;
|
||||
this.scGameLogic = _ScGameLogic;
|
||||
}
|
||||
|
||||
//Not every gem needs this
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (scGameLogic.CurrentState == GlobalEnums.GameState.move)
|
||||
if (this.scGameLogic.CurrentState == GameState.Move)
|
||||
{
|
||||
firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
mousePressed = true;
|
||||
this.firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
this.mousePressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Not every gem needs this
|
||||
private void CalculateAngle()
|
||||
{
|
||||
swipeAngle = Mathf.Atan2(finalTouchPosition.y - firstTouchPosition.y, finalTouchPosition.x - firstTouchPosition.x);
|
||||
swipeAngle = swipeAngle * 180 / Mathf.PI;
|
||||
this.swipeAngle = Mathf.Atan2(this.finalTouchPosition.y - this.firstTouchPosition.y, this.finalTouchPosition.x - this.firstTouchPosition.x);
|
||||
this.swipeAngle = this.swipeAngle * 180 / Mathf.PI;
|
||||
|
||||
if (Vector3.Distance(firstTouchPosition, finalTouchPosition) > .5f)
|
||||
if (Vector3.Distance(this.firstTouchPosition, this.finalTouchPosition) > .5f)
|
||||
MovePieces();
|
||||
}
|
||||
|
||||
//Not every gem needs this, maybe
|
||||
private void MovePieces()
|
||||
{
|
||||
previousPos = posIndex;
|
||||
this.previousPos = this.posIndex;
|
||||
|
||||
if (swipeAngle < 45 && swipeAngle > -45 && posIndex.x < SC_GameVariables.Instance.rowsSize - 1)
|
||||
if (this.swipeAngle < 45 && this.swipeAngle > -45 && this.posIndex.x < SC_GameVariables.Instance.rowsSize - 1)
|
||||
{
|
||||
otherGem = scGameLogic.GetGem(posIndex.x + 1, posIndex.y);
|
||||
otherGem.posIndex.x--;
|
||||
posIndex.x++;
|
||||
this.otherGem = this.scGameLogic.GetGem(this.posIndex.x + 1, this.posIndex.y);
|
||||
this.otherGem.posIndex.x--;
|
||||
this.posIndex.x++;
|
||||
|
||||
}
|
||||
else if (swipeAngle > 45 && swipeAngle <= 135 && posIndex.y < SC_GameVariables.Instance.colsSize - 1)
|
||||
else if (this.swipeAngle > 45 && this.swipeAngle <= 135 && this.posIndex.y < SC_GameVariables.Instance.colsSize - 1)
|
||||
{
|
||||
otherGem = scGameLogic.GetGem(posIndex.x, posIndex.y + 1);
|
||||
otherGem.posIndex.y--;
|
||||
posIndex.y++;
|
||||
this.otherGem = this.scGameLogic.GetGem(this.posIndex.x, this.posIndex.y + 1);
|
||||
this.otherGem.posIndex.y--;
|
||||
this.posIndex.y++;
|
||||
}
|
||||
else if (swipeAngle < -45 && swipeAngle >= -135 && posIndex.y > 0)
|
||||
else if (this.swipeAngle < -45 && this.swipeAngle >= -135 && this.posIndex.y > 0)
|
||||
{
|
||||
otherGem = scGameLogic.GetGem(posIndex.x, posIndex.y - 1);
|
||||
otherGem.posIndex.y++;
|
||||
posIndex.y--;
|
||||
this.otherGem = this.scGameLogic.GetGem(this.posIndex.x, this.posIndex.y - 1);
|
||||
this.otherGem.posIndex.y++;
|
||||
this.posIndex.y--;
|
||||
}
|
||||
else if (swipeAngle > 135 || swipeAngle < -135 && posIndex.x > 0)
|
||||
else if (this.swipeAngle > 135 || this.swipeAngle < -135 && this.posIndex.x > 0)
|
||||
{
|
||||
otherGem = scGameLogic.GetGem(posIndex.x - 1, posIndex.y);
|
||||
otherGem.posIndex.x++;
|
||||
posIndex.x--;
|
||||
this.otherGem = this.scGameLogic.GetGem(this.posIndex.x - 1, this.posIndex.y);
|
||||
this.otherGem.posIndex.x++;
|
||||
this.posIndex.x--;
|
||||
}
|
||||
|
||||
scGameLogic.SetGem(posIndex.x,posIndex.y, this);
|
||||
scGameLogic.SetGem(otherGem.posIndex.x, otherGem.posIndex.y, otherGem);
|
||||
this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this);
|
||||
this.scGameLogic.SetGem(this.otherGem.posIndex.x, this.otherGem.posIndex.y, this.otherGem);
|
||||
|
||||
StartCoroutine(CheckMoveCo());
|
||||
}
|
||||
@@ -109,27 +113,27 @@ public class SC_Gem : MonoBehaviour
|
||||
//Why are we checking matches on the Gem itself
|
||||
public IEnumerator CheckMoveCo()
|
||||
{
|
||||
scGameLogic.SetState(GlobalEnums.GameState.wait);
|
||||
this.scGameLogic.SetState(GameState.Wait);
|
||||
|
||||
yield return new WaitForSeconds(.5f);
|
||||
scGameLogic.FindAllMatches();
|
||||
this.scGameLogic.FindAllMatches();
|
||||
|
||||
if (otherGem != null)
|
||||
if (this.otherGem != null)
|
||||
{
|
||||
if (isMatch == false && otherGem.isMatch == false)
|
||||
if (this.isMatch == false && this.otherGem.isMatch == false)
|
||||
{
|
||||
otherGem.posIndex = posIndex;
|
||||
posIndex = previousPos;
|
||||
this.otherGem.posIndex = this.posIndex;
|
||||
this.posIndex = this.previousPos;
|
||||
|
||||
scGameLogic.SetGem(posIndex.x, posIndex.y, this);
|
||||
scGameLogic.SetGem(otherGem.posIndex.x, otherGem.posIndex.y, otherGem);
|
||||
this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this);
|
||||
this.scGameLogic.SetGem(this.otherGem.posIndex.x, this.otherGem.posIndex.y, this.otherGem);
|
||||
|
||||
yield return new WaitForSeconds(.5f);
|
||||
scGameLogic.SetState(GlobalEnums.GameState.move);
|
||||
this.scGameLogic.SetState(GameState.Move);
|
||||
}
|
||||
else
|
||||
{
|
||||
scGameLogic.DestroyMatches();
|
||||
this.scGameLogic.DestroyMatches();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/Scripts/Scopes.meta
Normal file
8
Assets/Scripts/Scopes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0487a87adc6c17c4596c6b6172a748cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/Scopes/RootLifetimeScope.cs
Normal file
10
Assets/Scripts/Scopes/RootLifetimeScope.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Scopes {
|
||||
public class RootLifetimeScope : LifetimeScope {
|
||||
protected override void Configure(IContainerBuilder builder) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Scopes/RootLifetimeScope.cs.meta
Normal file
3
Assets/Scripts/Scopes/RootLifetimeScope.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31d874275d6f4540a21f512df426fa88
|
||||
timeCreated: 1765628841
|
||||
3
Assets/Scripts/ScriptableObjects.meta
Normal file
3
Assets/Scripts/ScriptableObjects.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50912fd71c7e4d5db3823a63c84efe09
|
||||
timeCreated: 1765661086
|
||||
23
Assets/Scripts/ScriptableObjects/GameVariables.cs
Normal file
23
Assets/Scripts/ScriptableObjects/GameVariables.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
//Done, moved to GameVariables scriptable object
|
||||
namespace ScriptableObjects {
|
||||
[CreateAssetMenu(fileName = "GameVariables", menuName = "Game Variables")]
|
||||
public class GameVariables : ScriptableObject {
|
||||
public GameObject bgTilePrefabs;
|
||||
public GemView bombPrefab;
|
||||
public GemView[] gemsPrefabs;
|
||||
public GameObject[] destroyEffectPrefabs;
|
||||
public float bonusAmount = 0.5f;
|
||||
public float bombChance = 2f;
|
||||
public int dropHeight = 1;
|
||||
public float gemSpeed = 7;
|
||||
public float scoreSpeed = 5;
|
||||
|
||||
[HideInInspector]
|
||||
public int rowsSize = 7;
|
||||
[HideInInspector]
|
||||
public int colsSize = 7;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/ScriptableObjects/GameVariables.cs.meta
Normal file
3
Assets/Scripts/ScriptableObjects/GameVariables.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f37e854902a46cb8bd927cf84ab450c
|
||||
timeCreated: 1765656977
|
||||
188
Assets/Scripts/Services/GameBoardService.cs
Normal file
188
Assets/Scripts/Services/GameBoardService.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Enums;
|
||||
using Models.Interfaces;
|
||||
using ScriptableObjects;
|
||||
using Services.Interfaces;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
using Object = UnityEngine.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Services {
|
||||
public class GameBoardService : IGameBoardService {
|
||||
private IGameBoard gameBoard;
|
||||
private GameVariables gameVariables;
|
||||
private IMatchService matchService;
|
||||
private IScoreService scoreService;
|
||||
private Transform gemsHolder;
|
||||
|
||||
public GameBoardService(IGameBoard gameBoard, GameVariables gameVariables, IMatchService matchService, IScoreService scoreSerivce, Transform gemsHolder) {
|
||||
this.gameBoard = gameBoard;
|
||||
this.gameVariables = gameVariables;
|
||||
this.matchService = matchService;
|
||||
this.scoreService = scoreSerivce;
|
||||
this.gemsHolder = gemsHolder;
|
||||
}
|
||||
|
||||
private int RandomGemTypeAsInt() {
|
||||
GemType[] spawnableGems = Enum.GetValues(typeof(GemType))
|
||||
.Cast<GemType>()
|
||||
.Where(gType => gType != GemType.Bomb)
|
||||
.ToArray();
|
||||
|
||||
return Random.Range(0, spawnableGems.Length);
|
||||
}
|
||||
|
||||
public void Setup() {
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Vector2 position = new Vector2(x, y);
|
||||
GameObject backgroundTile = Object.Instantiate(this.gameVariables.bgTilePrefabs, position, Quaternion.identity);
|
||||
backgroundTile.transform.SetParent(this.gemsHolder);
|
||||
backgroundTile.name = "BG Tile - " + x + ", " + y;
|
||||
|
||||
|
||||
|
||||
int gemToUse = RandomGemTypeAsInt();
|
||||
|
||||
int iterations = 0;
|
||||
while (this.matchService.MatchesAt(new Vector2Int(x, y), (GemType)gemToUse) && iterations < 100)
|
||||
{
|
||||
gemToUse = RandomGemTypeAsInt();
|
||||
iterations++;
|
||||
}
|
||||
|
||||
//ToDo: change gameVariables.gemsPrefabs[gemToUse] since gemToUse is index, if the order changes it wont work
|
||||
SpawnGem(new Vector2Int(x, y), this.gameVariables.gemsPrefabs[gemToUse], (GemType)gemToUse);
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnGem(Vector2Int position, GemView gemPrefab, GemType gemType) {
|
||||
if (Random.Range(0, 100f) < this.gameVariables.bombChance)
|
||||
gemPrefab = this.gameVariables.bombPrefab;
|
||||
|
||||
GemView gemView = Object.Instantiate(gemPrefab, new Vector3(position.x, position.y + this.gameVariables.dropHeight, 0f), Quaternion.identity);
|
||||
gemView.transform.SetParent(this.gemsHolder);
|
||||
gemView.name = "Gem - " + position.x + ", " + position.y;
|
||||
SetGem(new Vector2Int(position.x,position.y), new Gem(gemType, position));
|
||||
}
|
||||
|
||||
public void SetGem(Vector2Int position, Gem gem) {
|
||||
this.gameBoard.SetGemAt(new Vector2Int(position.x, position.y), gem);
|
||||
}
|
||||
|
||||
public Gem GetGem(Vector2Int position) {
|
||||
return this.gameBoard.GetGemAt(position);
|
||||
}
|
||||
|
||||
public void DestroyMatches() {
|
||||
for (int i = 0; i < this.matchService.CurrentMatches.Count; i++)
|
||||
if (this.matchService.CurrentMatches[i] != null)
|
||||
{
|
||||
this.scoreService.ScoreCheck(this.matchService.CurrentMatches[i].ScoreValue);
|
||||
DestroyMatchedGems(this.matchService.CurrentMatches[i].Position);
|
||||
}
|
||||
|
||||
MoveGemsDown();
|
||||
}
|
||||
|
||||
public async UniTask MoveGemsDown() {
|
||||
await UniTask.Delay(2);
|
||||
// why the delay though?
|
||||
// yield return new WaitForSeconds(.2f);
|
||||
|
||||
int nullCounter = 0;
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x, y));
|
||||
if (currentGem == null)
|
||||
{
|
||||
nullCounter++;
|
||||
}
|
||||
else if (nullCounter > 0)
|
||||
{
|
||||
currentGem.SetPosition(new Vector2Int(currentGem.Position.x, currentGem.Position.y - nullCounter));
|
||||
SetGem(currentGem.Position, currentGem);
|
||||
SetGem(new Vector2Int(x,y), null);
|
||||
}
|
||||
}
|
||||
nullCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public async UniTask FillBoard() {
|
||||
await UniTask.Delay(5);
|
||||
RefillBoard();
|
||||
await UniTask.Delay(5);
|
||||
this.matchService.FindAllMatches();
|
||||
if (this.matchService.CurrentMatches.Count > 0)
|
||||
{
|
||||
await UniTask.Delay(5);
|
||||
DestroyMatches();
|
||||
}
|
||||
else
|
||||
{
|
||||
await UniTask.Delay(5);
|
||||
// currentState = GameState.Move;
|
||||
}
|
||||
}
|
||||
|
||||
public void RefillBoard() {
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x,y));
|
||||
if (currentGem == null) {
|
||||
int gemToUse = RandomGemTypeAsInt();
|
||||
SpawnGem(new Vector2Int(x, y), this.gameVariables.gemsPrefabs[gemToUse], (GemType)gemToUse);
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckMisplacedGems();
|
||||
}
|
||||
|
||||
public void CheckMisplacedGems() {
|
||||
List<GemView> gemsViews = GemsViews();
|
||||
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x,y));
|
||||
GemView gemView = gemsViews.FirstOrDefault(gv => gv.Gem == currentGem);
|
||||
|
||||
if (gemView != null) {
|
||||
gemsViews.Remove(gemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (GemView g in gemsViews)
|
||||
Object.Destroy(g.gameObject);
|
||||
}
|
||||
|
||||
public void DestroyMatchedGems(Vector2Int position) {
|
||||
List<GemView> gemsViews = GemsViews();
|
||||
Gem currentGem = this.gameBoard.GetGemAt(position);
|
||||
if (currentGem != null)
|
||||
{
|
||||
GemView gemView = gemsViews.FirstOrDefault(gv => gv.Gem == currentGem);
|
||||
Object.Instantiate(this.gameVariables.destroyEffectPrefabs[(int)currentGem.Type], new Vector2(position.x, position.y), Quaternion.identity);
|
||||
|
||||
Object.Destroy(gemView!.gameObject);
|
||||
SetGem(position, null);
|
||||
}
|
||||
}
|
||||
|
||||
private List<GemView> GemsViews() {
|
||||
return this.gemsHolder.GetComponentsInChildren<GemView>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/GameBoardService.cs.meta
Normal file
3
Assets/Scripts/Services/GameBoardService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e52d701a54645898c36c3f407ac890f
|
||||
timeCreated: 1765664126
|
||||
19
Assets/Scripts/Services/Interfaces/IGameBoardService.cs
Normal file
19
Assets/Scripts/Services/Interfaces/IGameBoardService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Enums;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
namespace Services.Interfaces {
|
||||
public interface IGameBoardService {
|
||||
void Setup();
|
||||
void SpawnGem(Vector2Int position, GemView gemPrefab, GemType gemType);
|
||||
void SetGem(Vector2Int position, Gem gem);
|
||||
Gem GetGem(Vector2Int position);
|
||||
void DestroyMatches();
|
||||
UniTask MoveGemsDown();
|
||||
UniTask FillBoard();
|
||||
void RefillBoard();
|
||||
void CheckMisplacedGems();
|
||||
void DestroyMatchedGems(Vector2Int position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c63053069b7e4791a82ee7dd04eae86c
|
||||
timeCreated: 1765662196
|
||||
9
Assets/Scripts/Services/Interfaces/IInputService.cs
Normal file
9
Assets/Scripts/Services/Interfaces/IInputService.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Services.Interfaces {
|
||||
public interface IInputService {
|
||||
event Action<Vector2> OnPointerDown;
|
||||
event Action<Vector2> OnPointerUp;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/Interfaces/IInputService.cs.meta
Normal file
3
Assets/Scripts/Services/Interfaces/IInputService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73b706bb5eea4fdf9b1f4563aef578cd
|
||||
timeCreated: 1765632542
|
||||
13
Assets/Scripts/Services/Interfaces/IMatchService.cs
Normal file
13
Assets/Scripts/Services/Interfaces/IMatchService.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Enums;
|
||||
|
||||
namespace Services.Interfaces {
|
||||
public interface IMatchService {
|
||||
List<Gem> CurrentMatches { get; }
|
||||
bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck);
|
||||
void FindAllMatches();
|
||||
void CheckForBombs();
|
||||
void MarkBombArea(Vector2Int bombPosition, int blastSize);
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/Interfaces/IMatchService.cs.meta
Normal file
3
Assets/Scripts/Services/Interfaces/IMatchService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 513ff6c9b21549f088abcb4c83143771
|
||||
timeCreated: 1765656570
|
||||
5
Assets/Scripts/Services/Interfaces/IScoreService.cs
Normal file
5
Assets/Scripts/Services/Interfaces/IScoreService.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Services.Interfaces {
|
||||
public interface IScoreService {
|
||||
void ScoreCheck(int value);
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/Interfaces/IScoreService.cs.meta
Normal file
3
Assets/Scripts/Services/Interfaces/IScoreService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d61c21960f14353b3f431434d3b4de2
|
||||
timeCreated: 1765674663
|
||||
99
Assets/Scripts/Services/MatchService.cs
Normal file
99
Assets/Scripts/Services/MatchService.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Enums;
|
||||
using Services.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Services {
|
||||
public class MatchService : IMatchService {
|
||||
private List<Gem> currentMatches = new List<Gem>();
|
||||
public List<Gem> CurrentMatches => this.currentMatches;
|
||||
|
||||
private GameBoard gameBoard;
|
||||
|
||||
public MatchService(GameBoard gameBoard) {
|
||||
this.gameBoard = gameBoard;
|
||||
}
|
||||
|
||||
public bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck) {
|
||||
Gem[,] gems = this.gameBoard.GemsGrid;
|
||||
if (positionToCheck.x > 1)
|
||||
{
|
||||
if (gems[positionToCheck.x - 1, positionToCheck.y].Type == gemTypeToCheck && gems[positionToCheck.x - 2, positionToCheck.y].Type == gemTypeToCheck)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (positionToCheck.y > 1)
|
||||
{
|
||||
if (gems[positionToCheck.x, positionToCheck.y - 1].Type == gemTypeToCheck && gems[positionToCheck.x, positionToCheck.y - 2].Type == gemTypeToCheck)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void FindAllMatches() {
|
||||
this.currentMatches.Clear();
|
||||
|
||||
for (int x = 0; x < this.gameBoard.Width; x++)
|
||||
for (int y = 0; y < this.gameBoard.Height; y++)
|
||||
{
|
||||
Gem currentGem = this.gameBoard.GemsGrid[x, y];
|
||||
if (currentGem != null)
|
||||
{
|
||||
if (x > 0 && x < this.gameBoard.Width - 1)
|
||||
{
|
||||
Gem leftGem = this.gameBoard.GemsGrid[x - 1, y];
|
||||
Gem rightGem = this.gameBoard.GemsGrid[x + 1, y];
|
||||
//checking no empty spots
|
||||
if (leftGem != null && rightGem != null)
|
||||
{
|
||||
//Match
|
||||
if (leftGem.Type == currentGem.Type && rightGem.Type == currentGem.Type)
|
||||
{
|
||||
currentGem.isMatch = true;
|
||||
leftGem.isMatch = true;
|
||||
rightGem.isMatch = true;
|
||||
this.currentMatches.Add(currentGem);
|
||||
this.currentMatches.Add(leftGem);
|
||||
this.currentMatches.Add(rightGem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (y > 0 && y < this.gameBoard.Height - 1)
|
||||
{
|
||||
Gem aboveGem = this.gameBoard.GemsGrid[x, y - 1];
|
||||
Gem bellowGem = this.gameBoard.GemsGrid[x, y + 1];
|
||||
//checking no empty spots
|
||||
if (aboveGem != null && bellowGem != null)
|
||||
{
|
||||
//Match
|
||||
if (aboveGem.Type == currentGem.Type && bellowGem.Type == currentGem.Type)
|
||||
{
|
||||
currentGem.isMatch = true;
|
||||
aboveGem.isMatch = true;
|
||||
bellowGem.isMatch = true;
|
||||
this.currentMatches.Add(currentGem);
|
||||
this.currentMatches.Add(aboveGem);
|
||||
this.currentMatches.Add(bellowGem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.currentMatches.Count > 0) this.currentMatches = this.currentMatches.Distinct().ToList();
|
||||
|
||||
CheckForBombs();
|
||||
}
|
||||
|
||||
public void CheckForBombs() {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void MarkBombArea(Vector2Int bombPosition, int blastSize) {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/MatchService.cs.meta
Normal file
3
Assets/Scripts/Services/MatchService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fca077f5e14456ab09ae9ea6bca7c61
|
||||
timeCreated: 1765665318
|
||||
@@ -2,22 +2,23 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Services.Interfaces;
|
||||
using UnityEngine;
|
||||
using Views;
|
||||
|
||||
namespace Services {
|
||||
public class ObjectPoolService:IObjectPool<GameObject> {
|
||||
private readonly GameObject prefab;
|
||||
public class ObjectPoolService:IObjectPool<GemView> {
|
||||
private readonly GemView prefab;
|
||||
private readonly Transform parent;
|
||||
private readonly int size;
|
||||
|
||||
private readonly Stack<GameObject> pool = new Stack<GameObject>();
|
||||
private readonly Stack<GemView> pool = new Stack<GemView>();
|
||||
|
||||
public ObjectPoolService(GameObject prefab, Transform parent, int size = 5) {
|
||||
public ObjectPoolService(GemView prefab, Transform parent, int size = 5) {
|
||||
this.prefab = prefab;
|
||||
this.parent = parent;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public GameObject Get() {
|
||||
public GemView Get() {
|
||||
return this.pool.Count == 0 ? Object.Instantiate(this.prefab, this.parent) : this.pool.Pop();
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace Services {
|
||||
}
|
||||
}
|
||||
|
||||
public void Release(GameObject gameObject) {
|
||||
public void Release(GemView gameObject) {
|
||||
this.pool.Push(gameObject);
|
||||
}
|
||||
|
||||
|
||||
11
Assets/Scripts/Services/ScoreService.cs
Normal file
11
Assets/Scripts/Services/ScoreService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using Services.Interfaces;
|
||||
|
||||
namespace Services {
|
||||
public class ScoreService : IScoreService {
|
||||
private int score = 0;
|
||||
public void ScoreCheck(int value) {
|
||||
this.score += value;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Services/ScoreService.cs.meta
Normal file
3
Assets/Scripts/Services/ScoreService.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5bac284955046708f571939e29d9dff
|
||||
timeCreated: 1765674722
|
||||
16
Assets/Scripts/Views/GemView.cs
Normal file
16
Assets/Scripts/Views/GemView.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Enums;
|
||||
using Services;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Views {
|
||||
public class GemView : MonoBehaviour {
|
||||
private Gem gem;
|
||||
public Gem Gem => this.gem;
|
||||
|
||||
public void UpdatePosition(Vector2Int positionBasedOnIndex) {
|
||||
if (Vector2.Distance(this.transform.position, positionBasedOnIndex) > 0.01f) {
|
||||
this.transform.position = Vector2.Lerp(this.transform.position, positionBasedOnIndex, 0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Views/GemView.cs.meta
Normal file
3
Assets/Scripts/Views/GemView.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7645dd1d371740729311dd834ab649f3
|
||||
timeCreated: 1765659213
|
||||
19
Assets/VContainerSettings.asset
Normal file
19
Assets/VContainerSettings.asset
Normal file
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9cf4d8df1d704d5689f3c69bd70d1cb9, type: 3}
|
||||
m_Name: VContainerSettings
|
||||
m_EditorClassIdentifier:
|
||||
RootLifetimeScope: {fileID: 7273189601935488900, guid: 520a563433527df408515da372ea797f,
|
||||
type: 3}
|
||||
EnableDiagnostics: 0
|
||||
DisableScriptModifier: 0
|
||||
RemoveClonePostfix: 0
|
||||
8
Assets/VContainerSettings.asset.meta
Normal file
8
Assets/VContainerSettings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f9315cf9da5a9c4c8cf80f5db8e6584
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
|
||||
"com.unity.ai.navigation": "1.1.6",
|
||||
"com.unity.collab-proxy": "2.10.2",
|
||||
"com.unity.feature.2d": "2.0.1",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.cysharp.unitask": {
|
||||
"version": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "73a63b7f672b88f7e9992f6917eb458a8cbb6fa9"
|
||||
},
|
||||
"com.unity.2d.animation": {
|
||||
"version": "9.2.0",
|
||||
"depth": 1,
|
||||
|
||||
@@ -142,7 +142,8 @@ PlayerSettings:
|
||||
visionOSBundleVersion: 1.0
|
||||
tvOSBundleVersion: 1.0
|
||||
bundleVersion: 0.1
|
||||
preloadedAssets: []
|
||||
preloadedAssets:
|
||||
- {fileID: 11400000, guid: 3f9315cf9da5a9c4c8cf80f5db8e6584, type: 2}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
121
ProjectSettings/SceneTemplateSettings.json
Normal file
121
ProjectSettings/SceneTemplateSettings.json
Normal file
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"templatePinStates": [],
|
||||
"dependencyTypeInfos": [
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimationClip",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Animations.AnimatorController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimatorOverrideController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Audio.AudioMixerController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ComputeShader",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Cubemap",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.GameObject",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.LightingDataAsset",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.LightingSettings",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Material",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.MonoScript",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicMaterial",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicsMaterial2D",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.VolumeProfile",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.SceneAsset",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Shader",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ShaderVariantCollection",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture2D",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Timeline.TimelineAsset",
|
||||
"defaultInstantiationMode": 0
|
||||
}
|
||||
],
|
||||
"defaultDependencyTypeInfo": {
|
||||
"userAdded": false,
|
||||
"type": "<default_scene_template_dependencies>",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
"newSceneOverride": 0
|
||||
}
|
||||
Reference in New Issue
Block a user