no message
This commit is contained in:
parent
99bd500107
commit
d5242af927
@ -5,6 +5,7 @@ using UnityEngine;
|
||||
using GoogleMobileAds.Api;
|
||||
using UnityEditor.PackageManager.Requests;
|
||||
using HexFiled;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class AdsMob : MonoBehaviour
|
||||
{
|
||||
@ -33,6 +34,7 @@ public class AdsMob : MonoBehaviour
|
||||
ExtraLife.lifeCount = lifeCount;
|
||||
ExtraLife life = FindObjectOfType<ExtraLife>();
|
||||
life.health += 1;
|
||||
|
||||
Respawn(life.gameObject);
|
||||
|
||||
}
|
||||
@ -47,7 +49,8 @@ public class AdsMob : MonoBehaviour
|
||||
|
||||
public void Respawn(GameObject player)
|
||||
{
|
||||
List<HexCell> cells = new List<HexCell>(FindObjectsOfType<HexCell>());
|
||||
List<HexCell> cells = new List<HexCell>();
|
||||
//cells.AddRange();
|
||||
// for (int i = 0; i < cells.Count; i++)
|
||||
// {
|
||||
|
||||
@ -56,10 +59,15 @@ public class AdsMob : MonoBehaviour
|
||||
{
|
||||
if(cell.Color == UnitColor.GREY)
|
||||
{
|
||||
var randomCell = UnityEngine.Random.Range(0, cells.Count);
|
||||
var randomCell = Random.Range(0, cells.Count);
|
||||
Vector3 respawnPosition = cells[randomCell].transform.position;
|
||||
//cells[randomCell].Color = UnitColor.YELLOW;
|
||||
player = FindObjectOfType<ExtraLife>().gameObject;
|
||||
player.transform.position = respawnPosition;
|
||||
if(player.transform.position == respawnPosition)
|
||||
{
|
||||
//cell.Color = UnitColor.YELLOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ namespace GameUI
|
||||
private readonly UIData _uiData;
|
||||
private PlayerControlView _playerControlView;
|
||||
private PlayerInventoryView _inventoryView;
|
||||
private AdsMob _add;
|
||||
private AdsMob _adsMob;
|
||||
|
||||
public PlayerControlView PlayerControlView => _playerControlView;
|
||||
public PlayerInventoryView PlayerInventoryView => _inventoryView;
|
||||
public AdsMob Add => _add;
|
||||
public AdsMob AdsMob => _adsMob;
|
||||
|
||||
public UIController(UIData uiData)
|
||||
{
|
||||
@ -27,7 +27,8 @@ namespace GameUI
|
||||
canvasGroup.AddComponent<CanvasGroup>();
|
||||
_playerControlView = Object.Instantiate(_uiData.PlayerControlView, canvasGroup.transform);
|
||||
_inventoryView = Object.Instantiate(_uiData.InventoryView, canvasGroup.transform);
|
||||
_add = Object.Instantiate(_uiData.Add, canvasGroup.transform);
|
||||
|
||||
_adsMob = Object.Instantiate(_uiData.Add, canvasGroup.transform);
|
||||
//_add.enabled = false;
|
||||
|
||||
_uiData.ObjectsToSpawn.ForEach(x => Object.Instantiate(x, canvasGroup.transform));
|
||||
|
@ -44,6 +44,7 @@ namespace Units
|
||||
public UnitColor Color => _data.color;
|
||||
public int InventoryCapacity => _data.inventoryCapacity;
|
||||
public Action<Item> OnItemPickUp;
|
||||
public Action<Unit> OnDeath;
|
||||
|
||||
public Unit(UnitInfo unitData, Weapon weapon, HexGrid hexGrid)
|
||||
{
|
||||
@ -280,7 +281,7 @@ namespace Units
|
||||
_barCanvas.HealthBar.DOFillAmount(hp / maxHp, 0.5f).SetEase(Ease.InQuad);
|
||||
}
|
||||
|
||||
private void Death()
|
||||
public void Death()
|
||||
{
|
||||
_unitView.OnStep -= MoveEnd;
|
||||
_unitView.OnAttackEnd -= AttackEnd;
|
||||
@ -288,6 +289,7 @@ namespace Units
|
||||
_unitView.OnHit -= Damage;
|
||||
_isAlive = false;
|
||||
_animator.SetTrigger("Death");
|
||||
OnDeath?.Invoke(this);
|
||||
MusicController.Instance.PlayAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, _instance);
|
||||
MusicController.Instance.RemoveAudioSource(_instance);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user