Добавлен респавн игрока после просмотра рекламы. (Нет спавна гексов цвета игрока при репавне.)
This commit is contained in:
parent
832807ae6d
commit
99bd500107
@ -59,7 +59,7 @@ Canvas:
|
|||||||
m_SortingBucketNormalizedSize: 0
|
m_SortingBucketNormalizedSize: 0
|
||||||
m_AdditionalShaderChannelsFlag: 25
|
m_AdditionalShaderChannelsFlag: 25
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingOrder: 1
|
m_SortingOrder: 0
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
--- !u!114 &855721723
|
--- !u!114 &855721723
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
@ -365,7 +365,7 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
@ -571,127 +571,3 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
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}
|
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using GoogleMobileAds.Api;
|
using GoogleMobileAds.Api;
|
||||||
using UnityEditor.PackageManager.Requests;
|
using UnityEditor.PackageManager.Requests;
|
||||||
|
using HexFiled;
|
||||||
|
|
||||||
public class AdsMob : MonoBehaviour
|
public class AdsMob : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ public class AdsMob : MonoBehaviour
|
|||||||
ExtraLife.lifeCount = lifeCount;
|
ExtraLife.lifeCount = lifeCount;
|
||||||
ExtraLife life = FindObjectOfType<ExtraLife>();
|
ExtraLife life = FindObjectOfType<ExtraLife>();
|
||||||
life.health += 1;
|
life.health += 1;
|
||||||
|
Respawn(life.gameObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +45,27 @@ public class AdsMob : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Respawn(GameObject player)
|
||||||
|
{
|
||||||
|
List<HexCell> cells = new List<HexCell>(FindObjectsOfType<HexCell>());
|
||||||
|
// 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<ExtraLife>().gameObject;
|
||||||
|
player.transform.position = respawnPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void OnDisable() {
|
private void OnDisable() {
|
||||||
_ad.OnUserEarnedReward -= HandleUser;
|
_ad.OnUserEarnedReward -= HandleUser;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using HexFiled;
|
||||||
|
|
||||||
public class ExtraLife : MonoBehaviour
|
public class ExtraLife : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -31,10 +32,30 @@ public class ExtraLife : MonoBehaviour
|
|||||||
if(lifeCount > 0)
|
if(lifeCount > 0)
|
||||||
{
|
{
|
||||||
canvasPref.gameObject.SetActive(false);
|
canvasPref.gameObject.SetActive(false);
|
||||||
|
//Respawn();
|
||||||
Time.timeScale = 1f;
|
Time.timeScale = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public void Respawn()
|
||||||
|
// {
|
||||||
|
// List<HexCell> cells = new List<HexCell>(FindObjectsOfType<HexCell>());
|
||||||
|
// // 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<ExtraLife>().gameObject;
|
||||||
|
// player.transform.position = respawnPosition;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// public void AddLIfe(int count)
|
// public void AddLIfe(int count)
|
||||||
// {
|
// {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user