added UI dodging nozzle on phones
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Core
|
||||
{
|
||||
public interface ILeaderBoardController
|
||||
{
|
||||
void ShowLeaderBoard();
|
||||
void UpdateLeaderBoardScore(int score);
|
||||
UniTask ShowLeaderBoardAsync();
|
||||
UniTask UpdateLeaderBoardScore(int score);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"references": [
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
8
Assets/DarkMatter/Code/Domain/GenericPool.meta
Normal file
8
Assets/DarkMatter/Code/Domain/GenericPool.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75a2920ba3d7abc4b94a5b95351e7dac
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Assets/DarkMatter/Code/Domain/GenericPool/ObjectPool.cs
Normal file
57
Assets/DarkMatter/Code/Domain/GenericPool/ObjectPool.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Darkmatter.Core;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Darkmatter.Domain
|
||||
{
|
||||
public class ObjectPool<T> : MonoBehaviour,IPool<T> where T : Component
|
||||
{
|
||||
[SerializeField] T prefab;
|
||||
[SerializeField] private Transform prefabParent;
|
||||
[SerializeField] private int poolSize = 15;
|
||||
|
||||
public Queue<T> pool = new Queue<T>();
|
||||
[Inject] IObjectResolver resolver;
|
||||
|
||||
public IReadOnlyCollection<T> All => pool;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CreateObjectPool();
|
||||
}
|
||||
|
||||
private void CreateObjectPool()
|
||||
{
|
||||
for(int i=0;i<poolSize; i++)
|
||||
{
|
||||
T obj = Instantiate(prefab, prefabParent);
|
||||
resolver.InjectGameObject(obj.gameObject);
|
||||
obj.gameObject.SetActive(false);
|
||||
pool.Enqueue(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public T GetFromPool()
|
||||
{
|
||||
if(pool.Count == 0)
|
||||
{
|
||||
T obj = Instantiate(prefab, prefabParent);
|
||||
resolver.InjectGameObject(obj.gameObject);
|
||||
obj.gameObject.SetActive(true);
|
||||
pool.Enqueue(obj);
|
||||
return obj;
|
||||
}
|
||||
T returningObj = pool.Dequeue();
|
||||
returningObj.gameObject.SetActive(true);
|
||||
return returningObj;
|
||||
}
|
||||
|
||||
public void ReturnToPool(T obj)
|
||||
{
|
||||
obj.gameObject.SetActive(false);
|
||||
pool.Enqueue(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e060b99c1df2bec40871a980f4b6c339
|
||||
@@ -2,6 +2,7 @@ using Unity.Services.Core;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Services.Authentication;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
@@ -13,7 +14,7 @@ namespace Darkmatter.Presentation
|
||||
await Init();
|
||||
}
|
||||
|
||||
private async Task Init()
|
||||
private async UniTask Init()
|
||||
{
|
||||
await UnityServices.InitializeAsync();
|
||||
if (!AuthenticationService.Instance.IsSignedIn)
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Platform : MonoBehaviour, IPlatform
|
||||
if(other.CompareTag("Player") && !hasAchievedScore)
|
||||
{
|
||||
hasAchievedScore = true;
|
||||
Debug.Log("Score Increased");
|
||||
IscoreService.AddScore();
|
||||
IaudioController.PlayScoredSound();
|
||||
_particleSystem.Play();
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||
"GUID:5540e30183c82e84b954c033c388e06c",
|
||||
"GUID:2073209246492244c9ad62c89d8d37bb",
|
||||
"GUID:fe25561d224ed4743af4c60938a59d0b"
|
||||
"GUID:fe25561d224ed4743af4c60938a59d0b",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Darkmatter.Presentation
|
||||
private void OnLeaderBoardBtnClicked()
|
||||
{
|
||||
IaudioController.PlayBtnPressedSound();
|
||||
IleaderBoardController.ShowLeaderBoard();
|
||||
IleaderBoardController.ShowLeaderBoardAsync();
|
||||
}
|
||||
|
||||
public void ShowDeathScreen()
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Darkmatter.Presentation
|
||||
|
||||
private void UpdateScore(int score)
|
||||
{
|
||||
Debug.Log("calling Score");
|
||||
gameScreenView.UpdateScore(score);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Darkmatter.Core;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.Services.Leaderboards;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
@@ -33,13 +35,16 @@ namespace Darkmatter.Presentation
|
||||
leaderBoardView.Hide();
|
||||
}
|
||||
|
||||
public void ShowLeaderBoard()
|
||||
public async UniTask ShowLeaderBoardAsync()
|
||||
{
|
||||
LoadLeaderBoard();
|
||||
leaderBoardView.Show();
|
||||
leaderBoardView.ShowLoading(true);
|
||||
await LoadLeaderBoard();
|
||||
leaderBoardView.ShowLoading(false);
|
||||
|
||||
}
|
||||
|
||||
async void LoadLeaderBoard()
|
||||
async UniTask LoadLeaderBoard()
|
||||
{
|
||||
var score = await LeaderboardsService.Instance.GetScoresAsync(leaderBoardID, new GetScoresOptions { Limit = 10 });
|
||||
int rank = 1;
|
||||
@@ -63,7 +68,7 @@ namespace Darkmatter.Presentation
|
||||
}
|
||||
}
|
||||
|
||||
public async void UpdateLeaderBoardScore(int score)
|
||||
public async UniTask UpdateLeaderBoardScore(int score)
|
||||
{
|
||||
await LeaderboardsService.Instance.AddPlayerScoreAsync(leaderBoardID, score);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Darkmatter.Presentation
|
||||
public GameObject leaderBoardScreen;
|
||||
public Button ExitButton;
|
||||
public LeaderBoardData LBplayerData;
|
||||
public TextMeshProUGUI loadingText;
|
||||
|
||||
public void Show()
|
||||
{
|
||||
@@ -20,5 +21,10 @@ namespace Darkmatter.Presentation
|
||||
{
|
||||
leaderBoardScreen.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowLoading(bool shouldShow)
|
||||
{
|
||||
loadingText.gameObject.SetActive(shouldShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Darkmatter.Presentation
|
||||
[Inject] private IGameSession IgameSession;
|
||||
public StartScreenController(StartScreenView _startScreenView, IGameScreenController _gameScreenController)
|
||||
{
|
||||
Debug.Log("StartScreenController Constructor Called");
|
||||
startScreenView = _startScreenView;
|
||||
gameScreenController = _gameScreenController;
|
||||
startScreenView.tapToStartButton.onClick.AddListener(OnTapToStartButtonClicked);
|
||||
|
||||
Reference in New Issue
Block a user