Commit ba4aa6f5 authored by Jan Meissner's avatar Jan Meissner

Reduced player hitbox, improved LevelSelect scripts, added preview for Level 13-14

parent 5db7d444
fileFormatVersion: 2
guid: 7e6ab90328c64eb42912d0b1f951661b
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1b8fdd0702d61f64e9387ab1e910d911
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
...@@ -178,7 +178,7 @@ BoxCollider2D: ...@@ -178,7 +178,7 @@ BoxCollider2D:
adaptiveTiling: 0 adaptiveTiling: 0
m_AutoTiling: 0 m_AutoTiling: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.95, y: 0.95} m_Size: {x: 0.85, y: 0.95}
m_EdgeRadius: 0 m_EdgeRadius: 0
--- !u!95 &95392249558912674 --- !u!95 &95392249558912674
Animator: Animator:
......
...@@ -4,23 +4,20 @@ using UnityEngine; ...@@ -4,23 +4,20 @@ using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class LevelSelectController : MonoBehaviour { public class LevelSelectController : MonoBehaviour {
//[SerializeField] private GameObject levelButtonPrefab;
[SerializeField] private GameObject pagePrefab; [SerializeField] private GameObject pagePrefab;
[SerializeField] private int nonPageObjects = 3; [SerializeField] private int nonPageObjects = 3;
private int highestLevel;
private int lastLevel;
private void Start() { private void Start() {
InitalizeLevelSelect(); InitalizeLevelSelect();
} }
/// <summary> /// <summary>
/// Locks all currently not unlocked levels /// Initializes LevelSelect
/// </summary> /// </summary>
public void InitalizeLevelSelect() public void InitalizeLevelSelect()
{ {
highestLevel = GameManager.Instance.HighestLevel; int highestLevel = GameManager.Instance.HighestLevel;
lastLevel = GameManager.Instance.LastLevel; int lastLevel = GameManager.Instance.LastLevel;
int pagesNeeded = lastLevel / 6 + 1; int pagesNeeded = lastLevel / 6 + 1;
int buttonsOnLastPage = lastLevel % 6; int buttonsOnLastPage = lastLevel % 6;
GameObject currentPage; GameObject currentPage;
...@@ -36,24 +33,21 @@ public class LevelSelectController : MonoBehaviour { ...@@ -36,24 +33,21 @@ public class LevelSelectController : MonoBehaviour {
String buttonName = "ButtonLevel" + j; String buttonName = "ButtonLevel" + j;
int levelNr = j + (currentPage.GetComponent<LevelSelectPageController>().PageNr-1) * 6; int levelNr = j + (currentPage.GetComponent<LevelSelectPageController>().PageNr-1) * 6;
if (GameObject.Find(buttonName) != null) GameObject button = currentPage.transform.Find(buttonName).gameObject;
Image image = button.transform.Find("Image").GetComponent<Image>();
// Level unlocked
if (levelNr <= highestLevel)
{ {
GameObject button = currentPage.transform.Find(buttonName).gameObject; string loadStr = levelNr < 10 ? "LevelSelect/Level0" + levelNr : "LevelSelect/Level" + levelNr;
Image image = button.transform.Find("Image").GetComponent<Image>(); image.sprite = Resources.Load(loadStr, typeof(Sprite)) as Sprite;
// Level unlocked button.transform.Find("Text").gameObject.GetComponent<TextMeshProUGUI>().text = levelNr + "";
if (levelNr <= highestLevel) button.GetComponent<Button>().interactable = true;
{ }
string loadStr = levelNr < 10 ? "LevelSelect/Level0" + levelNr : "LevelSelect/Level" + levelNr; // Level locked
image.sprite = Resources.Load(loadStr, typeof(Sprite)) as Sprite; else if (levelNr <= lastLevel)
button.transform.Find("Text").gameObject.GetComponent<TextMeshProUGUI>().text = levelNr + ""; {
button.GetComponent<Button>().interactable = true; image.sprite = Resources.Load("LevelSelect/lockedTEMP", typeof(Sprite)) as Sprite;
} button.GetComponent<Button>().interactable = false;
// Level locked
else if (levelNr <= lastLevel)
{
image.sprite = Resources.Load("LevelSelect/lockedTEMP", typeof(Sprite)) as Sprite;
button.GetComponent<Button>().interactable = false;
}
} }
} }
...@@ -66,7 +60,7 @@ public class LevelSelectController : MonoBehaviour { ...@@ -66,7 +60,7 @@ public class LevelSelectController : MonoBehaviour {
{ {
currentPage.transform.Find("ButtonNextPage").gameObject.SetActive(false); currentPage.transform.Find("ButtonNextPage").gameObject.SetActive(false);
// Deactivate not needed buttons // Deactivate not needed level buttons
if (buttonsOnLastPage != 0) if (buttonsOnLastPage != 0)
{ {
for (int j = 6; j > buttonsOnLastPage; j--) for (int j = 6; j > buttonsOnLastPage; j--)
...@@ -86,27 +80,17 @@ public class LevelSelectController : MonoBehaviour { ...@@ -86,27 +80,17 @@ public class LevelSelectController : MonoBehaviour {
private void DisablePagesAfterFirst() { private void DisablePagesAfterFirst() {
bool firstPage = true; bool firstPage = true;
foreach (GameObject page in GameObject.FindGameObjectsWithTag("LevelSelectPage")) { foreach (GameObject page in GameObject.FindGameObjectsWithTag("LevelSelectPage")) {
if (firstPage) { if (firstPage)
{
firstPage = false; firstPage = false;
} else { }
else
{
page.SetActive(false); page.SetActive(false);
} }
} }
} }
/// <summary>
/// Ensures all pages are active before loading "locked" images
/// </summary>
private void ActivateAllPages() {
foreach (GameObject page in GameObject.FindGameObjectsWithTag("LevelSelectPage")) {
page.SetActive(true);
}
}
public void LoadLevel(int level) {
GameManager.Instance.LoadLevel(level);
}
public void ShowNextPage(int pageNr) public void ShowNextPage(int pageNr)
{ {
GameObject canvas = transform.Find("Canvas").gameObject; GameObject canvas = transform.Find("Canvas").gameObject;
......
...@@ -8,7 +8,6 @@ public class LevelSelectPageController : MonoBehaviour { ...@@ -8,7 +8,6 @@ public class LevelSelectPageController : MonoBehaviour {
public void LoadLevel(int level) public void LoadLevel(int level)
{ {
level += (PageNr-1) * 6; level += (PageNr-1) * 6;
Debug.Log("Load level " + level);
GameManager.Instance.LoadLevel(level); GameManager.Instance.LoadLevel(level);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment