public void Resume() { PauseMenuUI.SetActive(false); Time.timeScale = 1f; GameIsPaused = false; NvpEventController.InvokeEvent("GameResumed", this, null); }
// Update is called once per frame void Update() { if (ball.transform.position.x >= 20f && canAddScore) { canAddScore = false; Spieler1Punkte++; } if (ball.transform.position.x <= -20f && canAddScore) { canAddScore = false; Spieler2Punkte++; } if (Spieler1Punkte >= 1) { //SceneManager.LoadScene(2); NvpEventController.InvokeEvent(NvpGameEvents.OnPlayerOneWins, this, null); } if (Spieler2Punkte >= 1) { //SceneManager.LoadScene(3); NvpEventController.InvokeEvent(NvpGameEvents.OnPlayerTwoWins, this, null); } Scoreboard.text = Spieler1Punkte.ToString() + " : " + Spieler2Punkte.ToString(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { NvpEventController.InvokeEvent(NvpGameEvents.OnPauseObjectCheck, this, null); } }
public void Pause() { PauseMenuUI.SetActive(true); Time.timeScale = 0f; GameIsPaused = true; NvpEventController.InvokeEvent("GamePaused", this, null); }
// Update is called once per frame void Update() { if (ball.transform.position.x >= 17f) { Bat_1_Score++; } if (ball.transform.position.x <= -17f) { Bat_2_Score++; } if (Bat_1_Score >= 2) { //SceneManager.LoadScene (2); NvpEventController.InvokeEvent(NvpGameEvents.OnPlayer1Wins, this, null); } if (Bat_2_Score >= 2) { //SceneManager.LoadScene(3); NvpEventController.InvokeEvent(NvpGameEvents.OnPlayer2Wins, this, null); } Scoreboard.text = Bat_1_Score.ToString() + " - " + Bat_2_Score.ToString(); print(Bat_1_Score + " , " + Bat_2_Score); }
// +++ Life Cycle +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void Start() { Debug.Log("StartCalled"); NvpEventController.SubscribeToEvent(NvpGameEvents.OnMainStarted, OnMainStarted); NvpEventController.SubscribeToEvent(NvpGameEvents.OnGameStarted, OnGameStarted); NvpEventController.SubscribeToEvent(NvpGameEvents.OnPlayerOneWins, OnPlayerOneWins); NvpEventController.SubscribeToEvent(NvpGameEvents.OnPlayAgain, OnPlayAgain); }
private void OnDisable() { NvpEventController.Events(MyEvent.PlayerSeesEnemy).GameEventHandler -= SoundManager_PlayerSeesEnemy; NvpEventController.Events(MyEvent.EnemySeesPlayer).GameEventHandler -= SoundManager_EnemySeesPlayer; NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler -= SoundManager_PlayerDies; NvpEventController.Events(MyEvent.HideInBox).GameEventHandler -= Play_HideInBox; NvpEventController.Events(MyEvent.LeaveBox).GameEventHandler -= Play_LeaveBox;; NvpEventController.Events(MyEvent.EnemyLostPlayer).GameEventHandler -= Play_LostPlayer; }
private void OnTriggerEnter(Collider other) { Player player = other.gameObject.GetComponent <Player>(); if (player != null) { NvpEventController.Events(MyEvent.OnHitByPlayer).TriggerEvent(this, new EnemyHitEventArgs(this, !movement.state.HasFlag(EnemyMovement.EnemyState.SeesPlayer))); } }
private void LeaveBox() { boxCollider.enabled = true; NvpEventController.Events(MyEvent.LeaveBox).TriggerEvent(this, null); currentKiste.Interact(gameObject, new BoxInteractEventArgs(transform.position.y * transform.localScale.y, false)); transform.localScale /= boxSmall; currentKiste = null; }
private void OnTriggerEnter(Collider other) { Player player = other.gameObject.GetComponent <Player>(); if (player != null) { NvpEventController.Events(MyEvent.LevelFinish).TriggerEvent(player, null); StartCoroutine(Win()); } }
private void GoInBox(Kiste kiste) { boxCollider.enabled = false; NvpEventController.Events(MyEvent.HideInBox).TriggerEvent(this, null); currentKiste = kiste; kiste.Interact(gameObject, new BoxInteractEventArgs(transform.position.y * transform.localScale.y, true)); transform.localScale *= boxSmall; transform.position = kiste.gameObject.transform.position; }
// +++ life cycle +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void Start() { Debug.Log("Start called"); NvpEventController.SubscribeToEvent(NvpGameEvents.OnMainStarted, OnMainStarted); NvpEventController.SubscribeToEvent(NvpGameEvents.OnGameStarted, OnGameStarted); NvpEventController.SubscribeToEvent(NvpGameEvents.OnPlayer1Wins, OnPlayer1Wins); NvpEventController.SubscribeToEvent(NvpGameEvents.OnPlayer2Wins, OnPlayer2Wins); NvpEventController.SubscribeToEvent(NvpGameEvents.OnResetGame, OnResetGame); NvpEventController.SubscribeToEvent(NvpGameEvents.OnExitGame, OnExitGame); NvpEventController.SubscribeToEvent(NvpGameEvents.OnOptionGame, OnOptionGame); NvpEventController.SubscribeToEvent(NvpGameEvents.OnExitOption, OnExitOption); }
private void Awake() { if (Instance) { Debug.LogError("More than one Singleton Object"); } else { Instance = this; scene = (Scenes)SceneManager.GetActiveScene().buildIndex; NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler += GameOver; NvpEventController.Events(MyEvent.LevelFinish).GameEventHandler += WinLevel; } }
public void Exit_Game() { //SceneManager.LoadScene(0); NvpEventController.InvokeEvent(NvpGameEvents.OnExitGame, this, null); }
private void OnEnable() { NvpEventController.Events(MyEvent.OnHitByPlayer).GameEventHandler += Player_GotHit; }
// Start is called before the first frame update void Start() { NvpEventController.SubscribeEvent("GamePaused", OnGamePaused); NvpEventController.SubscribeEvent("GameResumed", OnGameResumed); }
void OnDisable() { Debug.Log("DisableCalled"); NvpEventController.UnsubscribeFromEvent(NvpGameEvents.OnMainStarted, OnMainStarted); }
public void Nochmal_Spielen() { NvpEventController.InvokeEvent(NvpGameEvents.OnPlayAgain, this, null); }
// +++ unity callbacks ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void Awake() { _eventModel = new NvpEventModel(); _instance = this; }
// Start is called before the first frame update void Start() { NvpEventController.SubscribeToEvent(NvpGameEvents.OnPauseObjectCheck, OnPauseObjectCheck); }
void OnDisable() { NvpEventController.UnsubscribeFromEvent(NvpGameEvents.OnPauseObjectCheck, OnPauseObjectCheck); }
// Start is called before the first frame update async void Start() { await Task.Delay(TimeSpan.FromSeconds(1)); NvpEventController.InvokeEvent(NvpGameEvents.OnMainStarted, this, 42); }
private void OnDisable() { NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler += GameOver; NvpEventController.Events(MyEvent.LevelFinish).GameEventHandler += WinLevel; }
public void Exit_Option() { NvpEventController.InvokeEvent(NvpGameEvents.OnExitOption, this, null); }
public void Option_Game() { //SceneManager.LoadScene(4); NvpEventController.InvokeEvent(NvpGameEvents.OnOptionGame, this, null); }
private void OnDestroy() { NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler -= GameOver;; }
public void Reset_Game() { //SceneManager.LoadScene(1); NvpEventController.InvokeEvent(NvpGameEvents.OnResetGame, this, null); }
public void Play_Game() { //SceneManager.LoadScene (1); NvpEventController.InvokeEvent(NvpGameEvents.OnGameStarted, this, null); }