From 99bd5001071300b400000d9c81c9d6c0ac3c6945 Mon Sep 17 00:00:00 2001 From: DyatelO Date: Sat, 8 Jan 2022 03:57:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=80=D0=B5=D1=81=D0=BF=D0=B0=D0=B2=D0=BD=20=D0=B8?= =?UTF-8?q?=D0=B3=D1=80=D0=BE=D0=BA=D0=B0=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B0=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D0=BB=D0=B0=D0=BC=D1=8B.=20(=D0=9D=D0=B5?= =?UTF-8?q?=D1=82=20=D1=81=D0=BF=D0=B0=D0=B2=D0=BD=D0=B0=20=D0=B3=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D0=BE=D0=B2=20=D1=86=D0=B2=D0=B5=D1=82=D0=B0=20?= =?UTF-8?q?=D0=B8=D0=B3=D1=80=D0=BE=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BF=D0=B0=D0=B2=D0=BD=D0=B5.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefab/ADs.prefab | 2 +- Assets/Scenes/Level 1.unity | 126 +---------------------------- Assets/Scripts/ADs/AdsMob.cs | 24 +++++- Assets/Scripts/States/ExtraLife.cs | 21 +++++ 4 files changed, 46 insertions(+), 127 deletions(-) diff --git a/Assets/Prefab/ADs.prefab b/Assets/Prefab/ADs.prefab index 9f05d348..79843e14 100644 --- a/Assets/Prefab/ADs.prefab +++ b/Assets/Prefab/ADs.prefab @@ -59,7 +59,7 @@ Canvas: m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 25 m_SortingLayerID: 0 - m_SortingOrder: 1 + m_SortingOrder: 0 m_TargetDisplay: 0 --- !u!114 &855721723 MonoBehaviour: diff --git a/Assets/Scenes/Level 1.unity b/Assets/Scenes/Level 1.unity index 3c737b5f..164552ec 100644 --- a/Assets/Scenes/Level 1.unity +++ b/Assets/Scenes/Level 1.unity @@ -365,7 +365,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -571,127 +571,3 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &5568377705779749985 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 7017227080055577093, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_Name - value: ADs - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577093, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_RootOrder - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchorMax.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchorMin.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_SizeDelta.x - value: 100 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_SizeDelta.y - value: 100 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7017227080055577098, guid: 1328a0e1e252d60408278772275bf560, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 1328a0e1e252d60408278772275bf560, type: 3} diff --git a/Assets/Scripts/ADs/AdsMob.cs b/Assets/Scripts/ADs/AdsMob.cs index b299170e..4f325b8b 100644 --- a/Assets/Scripts/ADs/AdsMob.cs +++ b/Assets/Scripts/ADs/AdsMob.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using UnityEditor.PackageManager.Requests; +using HexFiled; public class AdsMob : MonoBehaviour { @@ -32,7 +33,7 @@ public class AdsMob : MonoBehaviour ExtraLife.lifeCount = lifeCount; ExtraLife life = FindObjectOfType(); life.health += 1; - + Respawn(life.gameObject); } @@ -44,6 +45,27 @@ public class AdsMob : MonoBehaviour } } + public void Respawn(GameObject player) + { + List cells = new List(FindObjectsOfType()); + // for (int i = 0; i < cells.Count; i++) + // { + + // } + foreach (var cell in cells) + { + if(cell.Color == UnitColor.GREY) + { + var randomCell = UnityEngine.Random.Range(0, cells.Count); + Vector3 respawnPosition = cells[randomCell].transform.position; + player = FindObjectOfType().gameObject; + player.transform.position = respawnPosition; + } + } + } + + + private void OnDisable() { _ad.OnUserEarnedReward -= HandleUser; } diff --git a/Assets/Scripts/States/ExtraLife.cs b/Assets/Scripts/States/ExtraLife.cs index 98fc89df..7cc54a68 100644 --- a/Assets/Scripts/States/ExtraLife.cs +++ b/Assets/Scripts/States/ExtraLife.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using HexFiled; public class ExtraLife : MonoBehaviour { @@ -31,10 +32,30 @@ public class ExtraLife : MonoBehaviour if(lifeCount > 0) { canvasPref.gameObject.SetActive(false); + //Respawn(); Time.timeScale = 1f; } } + + // public void Respawn() + // { + // List cells = new List(FindObjectsOfType()); + // // for (int i = 0; i < cells.Count; i++) + // // { + + // // } + // foreach (var cell in cells) + // { + // if(cell.Color == UnitColor.GREY) + // { + // var randomCell = Random.Range(0, cells.Count); + // Vector3 respawnPosition = cells[randomCell].transform.position; + // GameObject player = FindObjectOfType().gameObject; + // player.transform.position = respawnPosition; + // } + // } + // } // public void AddLIfe(int count) // {