[TASK] Added more duck spawn, performance fixes, instruction in the minigame, option to zoom in on stickers

This commit is contained in:
2019-08-30 00:39:13 +02:00
parent bb4b5afb18
commit c60a130874
51 changed files with 86781 additions and 45090 deletions

View File

@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Mapbox.Map;
using UnityEngine;
using UnityEngine.Serialization;
public enum GameState
{
@@ -12,6 +8,8 @@ public enum GameState
public class BadeendGoGameManager : MonoBehaviour
{
public DuckStickerData simpleDuckSticker;
public GameObject profileButton;
public GameObject mainMap;
public CollectedStickersUI stickerDisplay;
@@ -19,6 +17,7 @@ public class BadeendGoGameManager : MonoBehaviour
public GameObject minigameOverlay;
public DuckCollectedScreen duckCollectedScreen;
private GameState _gameState;
private CollectableDuckData _minigamePlayingForDuck;
@@ -28,13 +27,15 @@ public class BadeendGoGameManager : MonoBehaviour
set
{
_gameState = value;
profileButton.SetActive(value == GameState.Map);
minigameOverlay.SetActive(value == GameState.Minigame);
mainMap.SetActive(value == GameState.Map || value == GameState.DuckCollectedScreen);
stickerDisplay.gameObject.SetActive(value == GameState.StickerOverview);
miniGame.SetActive(value == GameState.Minigame);
duckCollectedScreen.gameObject.SetActive(value == GameState.DuckCollectedScreen);
profileButton.SetActive(value == GameState.Map);
minigameOverlay.SetActive(value == GameState.Minigame);
}
}
@@ -94,12 +95,23 @@ public class BadeendGoGameManager : MonoBehaviour
{
duckCollectedScreen.CollectedSticker = _minigamePlayingForDuck.StickerData;
}
else
{
duckCollectedScreen.CollectedSticker = simpleDuckSticker;
}
if (miniGameResult == MiniGameResult.Success)
{
// Duck collected
DuckStickerManager.Instance.OnStickerCollected(_minigamePlayingForDuck.StickerData);
CollectableDuckManager.Instance.OnDuckCollected(_minigamePlayingForDuck);
if (_minigamePlayingForDuck != null)
{
DuckStickerManager.Instance.OnStickerCollected(_minigamePlayingForDuck.StickerData);
CollectableDuckManager.Instance.OnDuckCollected(_minigamePlayingForDuck);
}
else
{
DuckStickerManager.Instance.OnStickerCollected(simpleDuckSticker);
}
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
using Random = UnityEngine.Random;
public class CatchMinigameManager : MonoBehaviour
@@ -40,6 +41,7 @@ public class CatchMinigameManager : MonoBehaviour
public TMP_Text scoreText;
public TMP_Text netAttemptText;
[FormerlySerializedAs("MInigameInstruction")] public MinigameInstruction minigameInstruction;
public float netCooldown = 0.5f;
public float netVelocity = 10f;
@@ -93,6 +95,8 @@ public class CatchMinigameManager : MonoBehaviour
activeDucks[i].gameObject.SetActive(false);
}
activeDucks.Clear();
minigameInstruction.Show();
}
void Update()

View File

@@ -19,16 +19,12 @@ public class CollectableDuck: MonoBehaviour
private void Update()
{
if (Input.GetMouseButtonUp(0))
if (Input.GetMouseButtonUp(0) && BadeendGoGameManager.Instance.GameState == GameState.Map)
{
var ray = _camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;;
if (Physics.Raycast(ray, out hit) && hit.collider == _collider)
{
if (CollectableDuckData == null)
{
throw new Exception("Unknown duck clicked in '" + gameObject.name + "'");
}
CollectableDuckManager.Instance.OnDuckClicked(CollectableDuckData);
}
}

View File

@@ -1,22 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DefaultNamespace;
using Mapbox.CheapRulerCs;
using Mapbox.Unity.Map;
using Mapbox.Utils;
using UnityEngine;
using Random = UnityEngine.Random;
public class CollectableDuckManager : MonoBehaviour
{
private class SimpleDuckData
{
public Vector2d location;
public DateTime spawnTime;
public DateTime despawnTime;
}
public List<CollectableDuckData> collectableDucks;
private readonly HashSet<CollectableDuckData> _collectedDucks = new HashSet<CollectableDuckData>();
private readonly Dictionary<CollectableDuckData, CollectableDuck> _spawnedDucks = new Dictionary<CollectableDuckData, CollectableDuck>();
private List<SimpleDuckData> existingSimpleDucks = new List<SimpleDuckData>();
private readonly Dictionary<SimpleDuckData, CollectableDuck> _spawnedSimpleDucks = new Dictionary<SimpleDuckData,CollectableDuck>();
public AbstractMap map;
public Transform player;
public Transform collectableDuckParent;
public float spawnStandardDuckTimeout = 1f;
public float spawnStandardDuckProbability = 0.1f;
public float standardDuckTimeout = 15 * 60;
public GameObject simpleDuckPrefab;
private float timeSinceStandardDuckSpawn = 0f;
public event EventHandler<CollectableDuckData> DuckClicked;
/// <summary>
@@ -82,6 +103,53 @@ public class CollectableDuckManager : MonoBehaviour
RemoveDuck(duck);
}
}
timeSinceStandardDuckSpawn += Time.deltaTime;
if (timeSinceStandardDuckSpawn > spawnStandardDuckTimeout)
{
timeSinceStandardDuckSpawn = 0;
if (Random.value < spawnStandardDuckProbability)
{
// Time to spawn a duck somewhere close to the player
double[] max = ruler.Destination(playerPosition, 100, 45);
double[] min = ruler.Destination(playerPosition, 100, 225);
var latDiff = max[0] - min[0];
var lonDiff = max[1] - min[1];
var duckCoord = new Vector2d(min[0] + (latDiff * Random.value), min[1] + (lonDiff * Random.value));
existingSimpleDucks.Add(new SimpleDuckData()
{
location = duckCoord,
despawnTime = DateTime.Now.AddSeconds(standardDuckTimeout),
spawnTime = DateTime.Now
});
}
}
for (int i = 0; i < existingSimpleDucks.Count; i++)
{
var duck = existingSimpleDucks[i];
if (duck.despawnTime < DateTime.Now)
{
existingSimpleDucks.RemoveAt(i);
i--;
HideSimpleDuck(duck);
}
else
{
var duckCoord = duck.location;
var dist = ruler.Distance(duckCoord.ToArray(), playerPosition);
// Debug.Log("Distance to " + duck.name + ": " + dist);
if (dist < spawnDistance)
{
SpawnSimpleDuck(duck);
}
else
{
HideSimpleDuck(duck);
}
}
}
}
private void SpawnDuck(CollectableDuckData duck)
@@ -105,6 +173,27 @@ public class CollectableDuckManager : MonoBehaviour
}
}
}
private void SpawnSimpleDuck(SimpleDuckData duck)
{
if (!_spawnedSimpleDucks.ContainsKey(duck))
{
// Spawn the duck
var duckSpawn = Instantiate(duckSpawnPrefab, map.GeoToWorldPosition(duck.location),
Quaternion.identity, collectableDuckParent);
var duckModel = Instantiate(simpleDuckPrefab, duckSpawn.transform);
duckModel.transform.localPosition = Vector3.zero;
_spawnedSimpleDucks[duck] = duckSpawn;
}
else
{
if (!_spawnedSimpleDucks[duck].gameObject.activeSelf)
{
_spawnedSimpleDucks[duck].gameObject.SetActive(true);
}
}
}
private void RemoveDuck(CollectableDuckData duck)
{
@@ -117,13 +206,23 @@ public class CollectableDuckManager : MonoBehaviour
}
}
private void HideSimpleDuck(SimpleDuckData duck)
{
if (_spawnedSimpleDucks.ContainsKey(duck))
{
if (_spawnedSimpleDucks[duck].gameObject.activeSelf)
{
_spawnedSimpleDucks[duck].gameObject.SetActive(false);
}
}
}
public void OnDuckClicked(CollectableDuckData duck)
{
if (DuckClicked != null)
{
DuckClicked.Invoke(this, duck);
}
}
public void OnDuckCollected(CollectableDuckData duck)

View File

@@ -7,12 +7,14 @@ public class CollectedStickersUI : MonoBehaviour
{
public Transform collectedStickerParent;
public StickerDisplay stickerDisplayPrefab;
public StickerZoomDisplay stickerZoomDisplay;
private readonly Dictionary<DuckStickerData, StickerDisplay> _stickerDisplays = new Dictionary<DuckStickerData, StickerDisplay>();
private void Start()
{
RefreshStickerDisplay();
stickerZoomDisplay.Hide();
}
public void OnStickerCollected(DuckStickerData sticker)
@@ -29,9 +31,19 @@ public class CollectedStickersUI : MonoBehaviour
{
var stickerDisplay = Instantiate(stickerDisplayPrefab, collectedStickerParent);
stickerDisplay.Sticker = sticker;
stickerDisplay.StickerClicked += (sender, obj) =>
{
stickerZoomDisplay.Sticker = obj;
stickerZoomDisplay.Show();
};
_stickerDisplays.Add(sticker, stickerDisplay);
}
_stickerDisplays[sticker].CollectedCount = DuckStickerManager.Instance.GetStickerCollectedCount(sticker);
}
}
public void OnCloseClicked()
{
BadeendGoGameManager.Instance.GameState = GameState.Map;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 92d9202652e22a6419212f3428917194
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b45c7b45c9256a745978ed0eb3cf5663
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2e45ca1b6714194e90f7eb923c3f243
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
using UnityEngine;
using System;
namespace Crystal
{
public class SafeAreaDemo : MonoBehaviour
{
[SerializeField] KeyCode KeySafeArea = KeyCode.A;
SafeArea.SimDevice[] Sims;
int SimIdx;
void Awake ()
{
if (!Application.isEditor)
Destroy (gameObject);
Sims = (SafeArea.SimDevice[])Enum.GetValues (typeof (SafeArea.SimDevice));
}
void Update ()
{
if (Input.GetKeyDown (KeySafeArea))
ToggleSafeArea ();
}
/// <summary>
/// Toggle the safe area simulation device.
/// </summary>
void ToggleSafeArea ()
{
SimIdx++;
if (SimIdx >= Sims.Length)
SimIdx = 0;
SafeArea.Sim = Sims[SimIdx];
Debug.LogFormat ("Switched to sim device {0} with debug key '{1}'", Sims[SimIdx], KeySafeArea);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9dd219ac2bff62648a6ae1c651c2eb5b
timeCreated: 1475885146
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
===============================
Safe Area Helper
===============================
Usage:
1. Create desired aspect ratios in the Game Window, e.g. 195:90 and 90:195 for iPhone X series.
2. Add the SafeArea.cs component to your GUI panels.
3. Add the SafeAreaDemo.cs once to a component in your scene.
4. Run the game and use the Toggle hotkey (default "A") to toggle between simulated devices.
Be sure to match the simulated device with the correct aspect ratio in your Game Window.
Add your own simulated devices:
1. Run an empty scene to the target mobile device with one GUI panel containing the SafeArea.cs component.
2. Rotate the device to each of the four orientations. Copy the pixel coordinates for each orientation from the debug output.
3. Enter the simulated device into SafeArea.cs using the same technique for the iPhone X.
See notes in SafeArea.cs and read our article online for a full breakdown of how the Safe Area works.
If you have a suggestion or request for a simluated device to be added to the list, please let us know in the Unity forums.
If this asset helped you, please rate us on the Asset Store!

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c5d0ac416e6c7847bc6fc71a0c41f8b
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,885 @@
%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: 8
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: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 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.44657898, g: 0.4964133, b: 0.5748178, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 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: 0
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
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 &211304472
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 211304473}
- component: {fileID: 211304475}
- component: {fileID: 211304474}
m_Layer: 5
m_Name: Img (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &211304473
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 211304472}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2009124497}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 1, y: 1}
--- !u!114 &211304474
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 211304472}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.6413793, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &211304475
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 211304472}
--- !u!1 &273423589
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 273423592}
- component: {fileID: 273423591}
- component: {fileID: 273423590}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &273423590
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 273423589}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &273423591
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 273423589}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &273423592
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 273423589}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &367253857
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 367253858}
- component: {fileID: 367253860}
- component: {fileID: 367253859}
m_Layer: 5
m_Name: PnlTop
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &367253858
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 367253857}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2009124497}
m_Father: {fileID: 741565324}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &367253859
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 367253857}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9264706, g: 0.9264706, b: 0.9264706, a: 0.435}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &367253860
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 367253857}
--- !u!1 &516573384
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 516573385}
- component: {fileID: 516573387}
- component: {fileID: 516573386}
m_Layer: 5
m_Name: Img (4)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &516573385
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 516573384}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2009124497}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 1, y: 0}
--- !u!114 &516573386
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 516573384}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0.08965516, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &516573387
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 516573384}
--- !u!1 &741565320
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 741565324}
- component: {fileID: 741565323}
- component: {fileID: 741565322}
- component: {fileID: 741565321}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &741565321
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 741565320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &741565322
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 741565320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1600, y: 900}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &741565323
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 741565320}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &741565324
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 741565320}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 367253858}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &998268192
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 998268193}
- component: {fileID: 998268195}
- component: {fileID: 998268194}
m_Layer: 5
m_Name: Img (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &998268193
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 998268192}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2009124497}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0, y: 1}
--- !u!114 &998268194
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 998268192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &998268195
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 998268192}
--- !u!1 &1444417745
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1444417747}
- component: {fileID: 1444417746}
m_Layer: 0
m_Name: SafeAreaToggle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1444417746
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1444417745}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9dd219ac2bff62648a6ae1c651c2eb5b, type: 3}
m_Name:
m_EditorClassIdentifier:
KeySafeArea: 97
--- !u!4 &1444417747
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1444417745}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1530250053
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1530250055}
- component: {fileID: 1530250054}
m_Layer: 0
m_Name: DirectionalLight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1530250054
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1530250053}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1530250055
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1530250053}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1659239518
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1659239522}
- component: {fileID: 1659239521}
- component: {fileID: 1659239520}
- component: {fileID: 1659239519}
m_Layer: 0
m_Name: MainCamera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1659239519
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1659239518}
m_Enabled: 1
--- !u!124 &1659239520
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1659239518}
m_Enabled: 1
--- !u!20 &1659239521
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1659239518}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
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: 0
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 &1659239522
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1659239518}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
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}
--- !u!1 &2009124496
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2009124497}
- component: {fileID: 2009124500}
- component: {fileID: 2009124499}
- component: {fileID: 2009124498}
m_Layer: 5
m_Name: PnlSafe
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2009124497
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2009124496}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 998268193}
- {fileID: 211304473}
- {fileID: 2093207634}
- {fileID: 516573385}
m_Father: {fileID: 367253858}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2009124498
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2009124496}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c97afc556caea1c44969477eb7ddec74, type: 3}
m_Name:
m_EditorClassIdentifier:
ConformX: 1
ConformY: 1
--- !u!114 &2009124499
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2009124496}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.722, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2009124500
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2009124496}
--- !u!1 &2093207633
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2093207634}
- component: {fileID: 2093207636}
- component: {fileID: 2093207635}
m_Layer: 5
m_Name: Img (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2093207634
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2093207633}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2009124497}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0, y: 0}
--- !u!114 &2093207635
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2093207633}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9862069, g: 1, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2093207636
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2093207633}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a6e5e67a77ff0402b907d9f025feb0f8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,206 @@
using UnityEngine;
namespace Crystal
{
/// <summary>
/// Safe area implementation for notched mobile devices. Usage:
/// (1) Add this component to the top level of any GUI panel.
/// (2) If the panel uses a full screen background image, then create an immediate child and put the component on that instead, with all other elements childed below it.
/// This will allow the background image to stretch to the full extents of the screen behind the notch, which looks nicer.
/// (3) For other cases that use a mixture of full horizontal and vertical background stripes, use the Conform X & Y controls on separate elements as needed.
/// </summary>
public class SafeArea : MonoBehaviour
{
#region Simulations
/// <summary>
/// Simulation device that uses safe area due to a physical notch or software home bar. For use in Editor only.
/// </summary>
public enum SimDevice
{
/// <summary>
/// Don't use a simulated safe area - GUI will be full screen as normal.
/// </summary>
None,
/// <summary>
/// Simulate the iPhone X and Xs (identical safe areas).
/// </summary>
iPhoneX,
/// <summary>
/// Simulate the iPhone Xs Max and XR (identical safe areas).
/// </summary>
iPhoneXsMax,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape left.
/// </summary>
Pixel3XL_LSL,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape right.
/// </summary>
Pixel3XL_LSR
}
/// <summary>
/// Simulation mode for use in editor only. This can be edited at runtime to toggle between different safe areas.
/// </summary>
public static SimDevice Sim = SimDevice.None;
/// <summary>
/// Normalised safe areas for iPhone X with Home indicator (ratios are identical to iPhone Xs). Absolute values:
/// PortraitU x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436;
/// PortraitD x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436 (not supported, remains in Portrait Up);
/// LandscapeL x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125;
/// LandscapeR x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125.
/// Aspect Ratio: ~19.5:9.
/// </summary>
Rect[] NSA_iPhoneX = new Rect[]
{
new Rect (0f, 102f / 2436f, 1f, 2202f / 2436f), // Portrait
new Rect (132f / 2436f, 63f / 1125f, 2172f / 2436f, 1062f / 1125f) // Landscape
};
/// <summary>
/// Normalised safe areas for iPhone Xs Max with Home indicator (ratios are identical to iPhone XR). Absolute values:
/// PortraitU x=0, y=102, w=1242, h=2454 on full extents w=1242, h=2688;
/// PortraitD x=0, y=102, w=1242, h=2454 on full extents w=1242, h=2688 (not supported, remains in Portrait Up);
/// LandscapeL x=132, y=63, w=2424, h=1179 on full extents w=2688, h=1242;
/// LandscapeR x=132, y=63, w=2424, h=1179 on full extents w=2688, h=1242.
/// Aspect Ratio: ~19.5:9.
/// </summary>
Rect[] NSA_iPhoneXsMax = new Rect[]
{
new Rect (0f, 102f / 2688f, 1f, 2454f / 2688f), // Portrait
new Rect (132f / 2688f, 63f / 1242f, 2424f / 2688f, 1179f / 1242f) // Landscape
};
/// <summary>
/// Normalised safe areas for Pixel 3 XL using landscape left. Absolute values:
/// PortraitU x=0, y=0, w=1440, h=2789 on full extents w=1440, h=2960;
/// PortraitD x=0, y=0, w=1440, h=2789 on full extents w=1440, h=2960;
/// LandscapeL x=171, y=0, w=2789, h=1440 on full extents w=2960, h=1440;
/// LandscapeR x=0, y=0, w=2789, h=1440 on full extents w=2960, h=1440.
/// Aspect Ratio: 18.5:9.
/// </summary>
Rect[] NSA_Pixel3XL_LSL = new Rect[]
{
new Rect (0f, 0f, 1f, 2789f / 2960f), // Portrait
new Rect (0f, 0f, 2789f / 2960f, 1f) // Landscape
};
/// <summary>
/// Normalised safe areas for Pixel 3 XL using landscape right. Absolute values and aspect ratio same as above.
/// </summary>
Rect[] NSA_Pixel3XL_LSR = new Rect[]
{
new Rect (0f, 0f, 1f, 2789f / 2960f), // Portrait
new Rect (171f / 2960f, 0f, 2789f / 2960f, 1f) // Landscape
};
#endregion
RectTransform Panel;
Rect LastSafeArea = new Rect (0, 0, 0, 0);
[SerializeField] bool ConformX = true; // Conform to screen safe area on X-axis (default true, disable to ignore)
[SerializeField] bool ConformY = true; // Conform to screen safe area on Y-axis (default true, disable to ignore)
void Awake ()
{
Panel = GetComponent<RectTransform> ();
if (Panel == null)
{
Debug.LogError ("Cannot apply safe area - no RectTransform found on " + name);
Destroy (gameObject);
}
Refresh ();
}
void Update ()
{
Refresh ();
}
void Refresh ()
{
Rect safeArea = GetSafeArea ();
if (safeArea != LastSafeArea)
ApplySafeArea (safeArea);
}
Rect GetSafeArea ()
{
Rect safeArea = Screen.safeArea;
if (Application.isEditor && Sim != SimDevice.None)
{
Rect nsa = new Rect (0, 0, Screen.width, Screen.height);
switch (Sim)
{
case SimDevice.iPhoneX:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_iPhoneX[0];
else // Landscape
nsa = NSA_iPhoneX[1];
break;
case SimDevice.iPhoneXsMax:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_iPhoneXsMax[0];
else // Landscape
nsa = NSA_iPhoneXsMax[1];
break;
case SimDevice.Pixel3XL_LSL:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_Pixel3XL_LSL[0];
else // Landscape
nsa = NSA_Pixel3XL_LSL[1];
break;
case SimDevice.Pixel3XL_LSR:
if (Screen.height > Screen.width) // Portrait
nsa = NSA_Pixel3XL_LSR[0];
else // Landscape
nsa = NSA_Pixel3XL_LSR[1];
break;
default:
break;
}
safeArea = new Rect (Screen.width * nsa.x, Screen.height * nsa.y, Screen.width * nsa.width, Screen.height * nsa.height);
}
return safeArea;
}
void ApplySafeArea (Rect r)
{
LastSafeArea = r;
// Ignore x-axis?
if (!ConformX)
{
r.x = 0;
r.width = Screen.width;
}
// Ignore y-axis?
if (!ConformY)
{
r.y = 0;
r.height = Screen.height;
}
// Convert safe area rectangle from absolute pixels to normalised anchor coordinates
Vector2 anchorMin = r.position;
Vector2 anchorMax = r.position + r.size;
anchorMin.x /= Screen.width;
anchorMin.y /= Screen.height;
anchorMax.x /= Screen.width;
anchorMax.y /= Screen.height;
Panel.anchorMin = anchorMin;
Panel.anchorMax = anchorMax;
Debug.LogFormat ("New safe area applied to {0}: x={1}, y={2}, w={3}, h={4} on full extents w={5}, h={6}",
name, r.x, r.y, r.width, r.height, Screen.width, Screen.height);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c97afc556caea1c44969477eb7ddec74
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
%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: 7d3768bc9b4537545bf3c5ae5663e033, type: 3}
m_Name: simple
m_EditorClassIdentifier:
_id: de6b6e76-0b57-4a89-8a35-82d7fc9cea74
_label: De standaard
_stickerSprite: {fileID: 21300000, guid: 5515ec29e18c45c43a02bdee225a33f5, type: 3}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 11b4e414271cc3849a9419b325b462dd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 5515ec29e18c45c43a02bdee225a33f5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
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: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -60,7 +60,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -72,7 +72,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -84,7 +84,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -96,7 +96,7 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
@@ -112,7 +112,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@@ -0,0 +1,7 @@
namespace DefaultNamespace
{
public interface ICollectableDuckData
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b3fc062eb15de5746a9fbc5cf5339b18
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(CanvasGroup))]
public class MinigameInstruction : MonoBehaviour
{
public float instructionTimeout = 2f;
public float fadeinTime = 0.5f;
private CanvasGroup _canvasGroup;
private void Awake()
{
_canvasGroup = GetComponent<CanvasGroup>();
_canvasGroup.alpha = 0;
}
public void Show()
{
StartCoroutine(FadeIn());
StartCoroutine(FadeOutAfterTimeout());
}
private IEnumerator FadeIn()
{
// Debug.Log("Fading in");
float t = 0;
while (t < fadeinTime)
{
t += Time.deltaTime;
_canvasGroup.alpha = t / fadeinTime;
yield return null;
}
_canvasGroup.alpha = 1;
}
private IEnumerator FadeOutAfterTimeout()
{
yield return new WaitForSeconds(instructionTimeout + fadeinTime);
// Debug.Log("Fading out");
float t = 0;
while (t < fadeinTime)
{
t += Time.deltaTime;
_canvasGroup.alpha = 1 - t / fadeinTime;
yield return null;
}
_canvasGroup.alpha = 0;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6856cc1cab0f5b41acecc754fc69ed9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -28,7 +28,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2783567737560892381}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.27, y: 0.528, z: 3.55}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.7, y: 0.7, z: 0.7}
m_Children:
- {fileID: 2783567737140453863}
@@ -92,6 +92,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
initialForce: {x: -100, y: 0, z: 0}
minimumVelocity: 3
duckCaughtCollider: {fileID: 0}
--- !u!1001 &2783567737140055853
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -0,0 +1,173 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4858003953750865989
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7420773870898185214}
- component: {fileID: 3279854819979680256}
m_Layer: 0
m_Name: SimpleDuckCollectible
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7420773870898185214
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4858003953750865989}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children:
- {fileID: 6069923289098750898}
- {fileID: 3490298527815546227}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3279854819979680256
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4858003953750865989}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9f8931783fc280145becdca83483472b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &3490298527815687185
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7420773870898185214}
m_Modifications:
- target: {fileID: 157990, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_Name
value: SpinningFrost
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 98e3c735093b9d24b8df0d00646fcac4, type: 3}
--- !u!4 &3490298527815546227 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 420194, guid: 98e3c735093b9d24b8df0d00646fcac4,
type: 3}
m_PrefabInstance: {fileID: 3490298527815687185}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &6069923289098936424
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7420773870898185214}
m_Modifications:
- target: {fileID: 178448, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_Name
value: RubberDuck_White_MOBILE
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071067
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: bfdf3dabf454006488fdee32f58e8f95, type: 3}
--- !u!4 &6069923289098750898 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 453594, guid: bfdf3dabf454006488fdee32f58e8f95,
type: 3}
m_PrefabInstance: {fileID: 6069923289098936424}
m_PrefabAsset: {fileID: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f7d7f183fa6cc2f459888c9d85309515
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/ProfileButton.cs Normal file
View File

@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProfileButton : MonoBehaviour
{
public void OnProfileButtonClicked()
{
BadeendGoGameManager.Instance.GameState = GameState.StickerOverview;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba13e0ab5563a304981f47f12e290d05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -6,10 +6,10 @@ using UnityEngine.Experimental.PlayerLoop;
public class Spinner : MonoBehaviour
{
private Vector3 speed = new Vector3(0, 1, 0);
private Vector3 speed = new Vector3(0, -90, 0);
private void Update()
{
transform.rotation = Quaternion.Euler(speed * Time.deltaTime);
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + speed * Time.deltaTime);
}
}

View File

@@ -1,16 +1,20 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class StickerDisplay : MonoBehaviour
public class StickerDisplay : MonoBehaviour, IPointerClickHandler
{
public TMP_Text label;
public TMP_Text duckCount;
public Image stickerImage;
public event EventHandler<DuckStickerData> StickerClicked;
private DuckStickerData _sticker;
public DuckStickerData Sticker
{
@@ -34,4 +38,10 @@ public class StickerDisplay : MonoBehaviour
duckCount.text = _collectedCount + "x";
}
}
public void OnPointerClick(PointerEventData eventData)
{
StickerClicked?.Invoke(this, Sticker);
}
}

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class StickerZoomDisplay : MonoBehaviour
{
[SerializeField] private Image stickerImage;
[SerializeField] private TMP_Text stickerLabel;
private DuckStickerData _sticker;
public DuckStickerData Sticker
{
get { return _sticker; }
set
{
_sticker = value;
stickerLabel.text = _sticker.Label;
stickerImage.sprite = _sticker.StickerSprite;
}
}
public void Show()
{
gameObject.SetActive(true);
}
public void Hide()
{
gameObject.SetActive(false);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 87e6bee2a20462f4e949dce4860e4ff2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: