added sounds
This commit is contained in:
138
Assets/Resources/Sounds/MyAudiioMixture.mixer
Normal file
138
Assets/Resources/Sounds/MyAudiioMixture.mixer
Normal file
@@ -0,0 +1,138 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!241 &24100000
|
||||
AudioMixerController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MyAudiioMixture
|
||||
m_OutputGroup: {fileID: 0}
|
||||
m_MasterGroup: {fileID: 24300002}
|
||||
m_Snapshots:
|
||||
- {fileID: 24500006}
|
||||
m_StartSnapshot: {fileID: 24500006}
|
||||
m_SuspendThreshold: -80
|
||||
m_EnableSuspend: 1
|
||||
m_UpdateMode: 0
|
||||
m_ExposedParameters: []
|
||||
m_AudioMixerGroupViews:
|
||||
- guids:
|
||||
- 5132dd24836975b4295f1c64b25b5e4d
|
||||
- 73d7f979fceceb0458b3ef39bf8f073d
|
||||
- a52bc2869a82eee419ca5163182d4f17
|
||||
name: View
|
||||
m_CurrentViewIndex: 0
|
||||
m_TargetSnapshot: {fileID: 24500006}
|
||||
--- !u!243 &24300002
|
||||
AudioMixerGroupController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Master
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: 5132dd24836975b4295f1c64b25b5e4d
|
||||
m_Children:
|
||||
- {fileID: 936482137231856778}
|
||||
- {fileID: 4161368961764744457}
|
||||
m_Volume: 527d34bedd868df418e67ae49b22a98a
|
||||
m_Pitch: 0e505e2c312c86a49861368de9ced932
|
||||
m_Send: 00000000000000000000000000000000
|
||||
m_Effects:
|
||||
- {fileID: 24400004}
|
||||
m_UserColorIndex: 0
|
||||
m_Mute: 0
|
||||
m_Solo: 0
|
||||
m_BypassEffects: 0
|
||||
--- !u!244 &24400004
|
||||
AudioMixerEffectController:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_EffectID: 10a5b8f7ac6cc094ba07516ee7636814
|
||||
m_EffectName: Attenuation
|
||||
m_MixLevel: 872d19d7cd8d25145bb252aa9989bc7b
|
||||
m_Parameters: []
|
||||
m_SendTarget: {fileID: 0}
|
||||
m_EnableWetMix: 0
|
||||
m_Bypass: 0
|
||||
--- !u!245 &24500006
|
||||
AudioMixerSnapshotController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Snapshot
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_SnapshotID: b125f6022dd0a104b9b54efeb28d266e
|
||||
m_FloatValues: {}
|
||||
m_TransitionOverrides: {}
|
||||
--- !u!244 &872118261864561489
|
||||
AudioMixerEffectController:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_EffectID: fbbe3dea09ef5c546b3c9bd10af84592
|
||||
m_EffectName: Attenuation
|
||||
m_MixLevel: 2593ac7bbd0bf744abd27f7b7c1ed110
|
||||
m_Parameters: []
|
||||
m_SendTarget: {fileID: 0}
|
||||
m_EnableWetMix: 0
|
||||
m_Bypass: 0
|
||||
--- !u!243 &936482137231856778
|
||||
AudioMixerGroupController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Music
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: 73d7f979fceceb0458b3ef39bf8f073d
|
||||
m_Children: []
|
||||
m_Volume: caac7c9334139f54abe11e5b47768405
|
||||
m_Pitch: ee267fecefb4c6040838343397c75b21
|
||||
m_Send: 00000000000000000000000000000000
|
||||
m_Effects:
|
||||
- {fileID: 2502528566780660521}
|
||||
m_UserColorIndex: 0
|
||||
m_Mute: 0
|
||||
m_Solo: 0
|
||||
m_BypassEffects: 0
|
||||
--- !u!244 &2502528566780660521
|
||||
AudioMixerEffectController:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_EffectID: 41a2ebad3f2a9dc40aad0c3cea0b81c9
|
||||
m_EffectName: Attenuation
|
||||
m_MixLevel: 8cb879fe13c2d7646b3e62769d8dddd4
|
||||
m_Parameters: []
|
||||
m_SendTarget: {fileID: 0}
|
||||
m_EnableWetMix: 0
|
||||
m_Bypass: 0
|
||||
--- !u!243 &4161368961764744457
|
||||
AudioMixerGroupController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Sfx
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: a52bc2869a82eee419ca5163182d4f17
|
||||
m_Children: []
|
||||
m_Volume: 348b00e64187ec641af4c42690f376c9
|
||||
m_Pitch: 4c324616c46dbd948a6295e0eb90f7b3
|
||||
m_Send: 00000000000000000000000000000000
|
||||
m_Effects:
|
||||
- {fileID: 872118261864561489}
|
||||
m_UserColorIndex: 0
|
||||
m_Mute: 0
|
||||
m_Solo: 0
|
||||
m_BypassEffects: 0
|
||||
8
Assets/Resources/Sounds/MyAudiioMixture.mixer.meta
Normal file
8
Assets/Resources/Sounds/MyAudiioMixture.mixer.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2e028ac02ea57942bcfe586e0fda8b0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 24100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
8
Assets/Scripts/AudioScripts.meta
Normal file
8
Assets/Scripts/AudioScripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 069731fdb7a6d4d4a84e277d895a4661
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/AudioScripts/AudioController.cs
Normal file
24
Assets/Scripts/AudioScripts/AudioController.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioSource MusicSource;
|
||||
[SerializeField] private AudioSource SFXSource;
|
||||
|
||||
public AudioClip backgroundMusicClip;
|
||||
public AudioClip jumpClip;
|
||||
public AudioClip deathClip;
|
||||
public AudioClip BtnPressedClip;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
MusicSource.clip = backgroundMusicClip;
|
||||
MusicSource.loop = true;
|
||||
MusicSource.Play();
|
||||
}
|
||||
|
||||
public void PlaySfx(AudioClip clip)
|
||||
{
|
||||
SFXSource.PlayOneShot(clip);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/AudioScripts/AudioController.cs.meta
Normal file
2
Assets/Scripts/AudioScripts/AudioController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ef25ef6976b18845b4fa4ea67c8b39b
|
||||
@@ -27,6 +27,7 @@ public class InputReaderSO : ScriptableObject, GameInputAction.IPlayerActions ,
|
||||
action.Enable();
|
||||
action.Player.SetCallbacks(this);
|
||||
blockedInput = false;
|
||||
isMouseButtonPressed= false;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
|
||||
74
Assets/Scripts/LifeTimeScope/GameFlowController.cs
Normal file
74
Assets/Scripts/LifeTimeScope/GameFlowController.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class GameFlowController:IStartable
|
||||
{
|
||||
private readonly Player _player;
|
||||
private readonly StartScreenController _startScreenController;
|
||||
private readonly GameScreenController _gameScreenController;
|
||||
private readonly ScoreService _scoreService;
|
||||
private readonly PauseScreenController _pauseScreenController;
|
||||
private readonly DeathScreenController _deathScreenController;
|
||||
private readonly IInputReader InputReader;
|
||||
|
||||
public GameFlowController(
|
||||
DeathScreenController deathScreenController,
|
||||
Player player,
|
||||
StartScreenController startScreenController,
|
||||
GameScreenController gameScreenController,
|
||||
ScoreService scoreService,
|
||||
PauseScreenController pauseScreenController,
|
||||
IInputReader inputReader)
|
||||
{
|
||||
_deathScreenController = deathScreenController;
|
||||
_player = player;
|
||||
_startScreenController = startScreenController;
|
||||
_gameScreenController = gameScreenController;
|
||||
_scoreService = scoreService;
|
||||
_pauseScreenController = pauseScreenController;
|
||||
InputReader = inputReader;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Debug.Log("GameFlowController Started");
|
||||
HookEvents();
|
||||
}
|
||||
|
||||
void HookEvents()
|
||||
{
|
||||
_startScreenController.OnStartPressed += HandleGameStart;
|
||||
_gameScreenController.OnPausePressed += HandleGamePause;
|
||||
_pauseScreenController.OnResumePressed += HandleGameResume;
|
||||
_pauseScreenController.OnRestartPressed += HandleGameRestart;
|
||||
_deathScreenController.OnRestartPressed += HandleGameRestart;
|
||||
_deathScreenController.OnExitPressed += HandleGameExit;
|
||||
|
||||
}
|
||||
|
||||
private void HandleGameRestart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void HandleGameExit()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void HandleGameResume()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void HandleGamePause()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void HandleGameStart()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/LifeTimeScope/GameFlowController.cs.meta
Normal file
2
Assets/Scripts/LifeTimeScope/GameFlowController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b7284c012c95d3408acb8cc1914fe31
|
||||
@@ -9,6 +9,13 @@ public class GameLifetimeScope : LifetimeScope
|
||||
[SerializeField] private PlatformManager manager;
|
||||
[SerializeField] private InputReaderSO inputReader;
|
||||
[SerializeField] private Player player;
|
||||
[SerializeField] private AudioController audioController;
|
||||
|
||||
//UI References
|
||||
[SerializeField] private GameScreenView gameScreenView;
|
||||
[SerializeField] private StartScreenView startScreenView;
|
||||
[SerializeField] private DeathScreenView deathScreenView;
|
||||
[SerializeField] private PauseScreenView pauseScreenView;
|
||||
protected override void Configure(IContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterComponent(pool).As<IPool>();
|
||||
@@ -16,6 +23,14 @@ public class GameLifetimeScope : LifetimeScope
|
||||
builder.RegisterInstance(inputReader).As<IInputReader>();
|
||||
builder.Register<ScoreService>(Lifetime.Singleton);
|
||||
builder.RegisterComponent(player);
|
||||
|
||||
builder.RegisterComponent(audioController);
|
||||
|
||||
builder.Register<GameScreenController>(Lifetime.Singleton).WithParameter(gameScreenView);
|
||||
builder.Register<StartScreenController>(Lifetime.Singleton).WithParameter(startScreenView);
|
||||
builder.Register<DeathScreenController>(Lifetime.Singleton).WithParameter(deathScreenView);
|
||||
builder.Register<PauseScreenController>(Lifetime.Singleton).WithParameter(pauseScreenView);
|
||||
|
||||
builder.RegisterEntryPoint<GameFlowController>(Lifetime.Singleton);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,43 @@
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class Player : MonoBehaviour
|
||||
public class Player : MonoBehaviour, IPlayer
|
||||
{
|
||||
[SerializeField] private float jumpForce = 1f;
|
||||
[SerializeField] private float jumpForce = 3f;
|
||||
[SerializeField] private Rigidbody rb;
|
||||
[SerializeField] private GameObject splashObject;
|
||||
[SerializeField] private Transform splashParent;
|
||||
public bool isDead = false;
|
||||
public ParticleSystem deadParticle;
|
||||
[SerializeField] private ParticleSystem deadParticle;
|
||||
[SerializeField] private ParticleSystem jumpParticle;
|
||||
|
||||
public bool isDead { get; private set; }
|
||||
|
||||
|
||||
[Inject] private IInputReader inputReader;
|
||||
[Inject] private DeathScreenController deathScreenController;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
isDead = false;
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
ShowAndHideSplash(collision);
|
||||
if (collision.gameObject.CompareTag("Safe") && !isDead)
|
||||
if(isDead) return;
|
||||
|
||||
if (collision.gameObject.CompareTag("Safe"))
|
||||
{
|
||||
rb.linearVelocity = Vector3.up * jumpForce;
|
||||
jumpParticle.Play();
|
||||
}
|
||||
else if(collision.gameObject.CompareTag("Death"))
|
||||
{
|
||||
isDead = true;
|
||||
deadParticle.Play();
|
||||
this.GetComponent<Renderer>().enabled = false;
|
||||
inputReader.blockedInput = true;
|
||||
inputReader.blockedInput = true;
|
||||
deathScreenController.ShowDeathScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,3 +50,8 @@ public class Player : MonoBehaviour
|
||||
Destroy(instancedSplash, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IPlayer
|
||||
{
|
||||
bool isDead { get; }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class ScoreService
|
||||
{
|
||||
public int score=0;
|
||||
public int highScore=0;
|
||||
public int highScore=PlayerPrefs.GetInt("HighScore",0);
|
||||
|
||||
public void AddScore()
|
||||
{
|
||||
@@ -18,6 +19,7 @@ public class ScoreService
|
||||
{
|
||||
highScore = score;
|
||||
PlayerPrefs.SetInt("HighScore", highScore);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
8
Assets/Scripts/UI.meta
Normal file
8
Assets/Scripts/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a1f2e0377d10e343b9657299e3aad8b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Scripts/UI/DeathScreenController.cs
Normal file
34
Assets/Scripts/UI/DeathScreenController.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class DeathScreenController
|
||||
{
|
||||
private DeathScreenView deathScreenView;
|
||||
public event Action OnRestartPressed;
|
||||
public event Action OnExitPressed;
|
||||
|
||||
[Inject] private ScoreService scoreService;
|
||||
public DeathScreenController(DeathScreenView _deathScreenView)
|
||||
{
|
||||
deathScreenView = _deathScreenView;
|
||||
deathScreenView.restartBtn.onClick.AddListener(() => OnRestartPressed?.Invoke());
|
||||
deathScreenView.exitBtn.onClick.AddListener(()=>OnExitPressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowDeathScreen()
|
||||
{
|
||||
deathScreenView.Show(scoreService.score,scoreService.highScore);
|
||||
}
|
||||
|
||||
private void OnExitButtonClicked()
|
||||
{
|
||||
Debug.Log("Exit Button Clicked");
|
||||
}
|
||||
|
||||
private void OnRestartButtonClicked()
|
||||
{
|
||||
Debug.Log("Restart Button Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/DeathScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/DeathScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a02f33f5247de546a0a273165e9cf96
|
||||
24
Assets/Scripts/UI/DeathScreenView.cs
Normal file
24
Assets/Scripts/UI/DeathScreenView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeathScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject deathScreen;
|
||||
public Button restartBtn;
|
||||
public Button exitBtn;
|
||||
public TextMeshProUGUI score;
|
||||
public TextMeshProUGUI highScore;
|
||||
|
||||
public void Show(int _score, int _highScore)
|
||||
{
|
||||
this.score.text = _score.ToString();
|
||||
this.highScore.text = _highScore.ToString();
|
||||
deathScreen.SetActive(true);
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
deathScreen.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/UI/DeathScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/DeathScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76c438a869d58da489fc53c68f98d32d
|
||||
25
Assets/Scripts/UI/GameScreenController.cs
Normal file
25
Assets/Scripts/UI/GameScreenController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
public class GameScreenController
|
||||
{
|
||||
GameScreenView gameScreenView;
|
||||
public event Action OnPausePressed;
|
||||
public GameScreenController(GameScreenView _gameScreenView)
|
||||
{
|
||||
this.gameScreenView = _gameScreenView;
|
||||
gameScreenView.pauseBtn.onClick.AddListener(()=>OnPausePressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowGameScreen()
|
||||
{
|
||||
gameScreenView.Show();
|
||||
}
|
||||
|
||||
public void OnPauseButtonClicked()
|
||||
{
|
||||
Debug.Log("Paused Btn Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/GameScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/GameScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 114040c725db5444583af5f21fd0e0b8
|
||||
25
Assets/Scripts/UI/GameScreenView.cs
Normal file
25
Assets/Scripts/UI/GameScreenView.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject gameScreen;
|
||||
public Button pauseBtn;
|
||||
[SerializeField] private TextMeshProUGUI scoreText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
gameScreen.SetActive(false);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
gameScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameScreen.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/GameScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/GameScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 808ee37de5cf8b546b46962c901f0332
|
||||
31
Assets/Scripts/UI/PauseScreenController.cs
Normal file
31
Assets/Scripts/UI/PauseScreenController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class PauseScreenController
|
||||
{
|
||||
private PauseScreenView pauseScreenView;
|
||||
public event Action OnResumePressed;
|
||||
public event Action OnRestartPressed;
|
||||
|
||||
public PauseScreenController(PauseScreenView _pauseScreenView)
|
||||
{
|
||||
pauseScreenView = _pauseScreenView;
|
||||
pauseScreenView.resumeBtn.onClick.AddListener(()=>OnRestartPressed?.Invoke());
|
||||
pauseScreenView.restartBtn.onClick.AddListener(()=>OnRestartPressed?.Invoke());
|
||||
}
|
||||
|
||||
public void ShowPauseScreen()
|
||||
{
|
||||
pauseScreenView.Show();
|
||||
}
|
||||
|
||||
private void OnRestartButtonClicked()
|
||||
{
|
||||
Debug.Log("Restart Button Clicked");
|
||||
}
|
||||
|
||||
private void OnResumeButtonClicked()
|
||||
{
|
||||
Debug.Log("Resume Button Clicked");
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/PauseScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/PauseScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a02a1a48e230b5743b3aedb6b9dcf4e3
|
||||
19
Assets/Scripts/UI/PauseScreenView.cs
Normal file
19
Assets/Scripts/UI/PauseScreenView.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PauseScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public GameObject pauseScreen;
|
||||
public Button resumeBtn;
|
||||
public Button restartBtn;
|
||||
|
||||
public void Show()
|
||||
{
|
||||
pauseScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
pauseScreen.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/PauseScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/PauseScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9139af2b841ef584da86e7b387b494d5
|
||||
24
Assets/Scripts/UI/StartScreenController.cs
Normal file
24
Assets/Scripts/UI/StartScreenController.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class StartScreenController
|
||||
{
|
||||
private StartScreenView startScreenView;
|
||||
public event Action OnStartPressed;
|
||||
public StartScreenController(StartScreenView _startScreenView)
|
||||
{
|
||||
Debug.Log("StartScreenController Constructor Called");
|
||||
startScreenView = _startScreenView;
|
||||
startScreenView.tapToStartButton.onClick.AddListener(() => OnStartPressed?.Invoke());
|
||||
}
|
||||
|
||||
private void OnTapToStartButtonClicked()
|
||||
{
|
||||
startScreenView.Hide();
|
||||
}
|
||||
public void ShowStartScreen()
|
||||
{
|
||||
startScreenView.Show();
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/StartScreenController.cs.meta
Normal file
2
Assets/Scripts/UI/StartScreenController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 940b62ceff11bbd498aab6bfc2cdeebe
|
||||
24
Assets/Scripts/UI/StartScreenView.cs
Normal file
24
Assets/Scripts/UI/StartScreenView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StartScreenView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject startScreen;
|
||||
public Button tapToStartButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//startScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
startScreen.SetActive(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
startScreen.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/UI/StartScreenView.cs.meta
Normal file
2
Assets/Scripts/UI/StartScreenView.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e48dcf0a824cead4d8c1339c10b81b3b
|
||||
@@ -34,6 +34,9 @@ MonoBehaviour:
|
||||
highQualityFiltering:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
filter:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
downscale:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
|
||||
Reference in New Issue
Block a user