Exemplo n.º 1
0
 public void Resume()
 {
     PauseMenuUI.SetActive(false);
     Time.timeScale = 1f;
     GameIsPaused   = false;
     NvpEventController.InvokeEvent("GameResumed", this, null);
 }
Exemplo n.º 2
0
    // 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();
    }
Exemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         NvpEventController.InvokeEvent(NvpGameEvents.OnPauseObjectCheck, this, null);
     }
 }
Exemplo n.º 4
0
 public void Pause()
 {
     PauseMenuUI.SetActive(true);
     Time.timeScale = 0f;
     GameIsPaused   = true;
     NvpEventController.InvokeEvent("GamePaused", this, null);
 }
Exemplo n.º 5
0
    // 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);
    }
Exemplo n.º 6
0
 // +++ 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);
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
    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)));
        }
    }
Exemplo n.º 9
0
    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;
    }
Exemplo n.º 10
0
    private void OnTriggerEnter(Collider other)
    {
        Player player = other.gameObject.GetComponent <Player>();

        if (player != null)
        {
            NvpEventController.Events(MyEvent.LevelFinish).TriggerEvent(player, null);
            StartCoroutine(Win());
        }
    }
Exemplo n.º 11
0
    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;
    }
Exemplo n.º 12
0
 // +++ 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);
 }
Exemplo n.º 13
0
 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;
     }
 }
Exemplo n.º 14
0
 public void Exit_Game()
 {
     //SceneManager.LoadScene(0);
     NvpEventController.InvokeEvent(NvpGameEvents.OnExitGame, this, null);
 }
Exemplo n.º 15
0
 private void OnEnable()
 {
     NvpEventController.Events(MyEvent.OnHitByPlayer).GameEventHandler += Player_GotHit;
 }
Exemplo n.º 16
0
 // Start is called before the first frame update
 void Start()
 {
     NvpEventController.SubscribeEvent("GamePaused", OnGamePaused);
     NvpEventController.SubscribeEvent("GameResumed", OnGameResumed);
 }
Exemplo n.º 17
0
 void OnDisable()
 {
     Debug.Log("DisableCalled");
     NvpEventController.UnsubscribeFromEvent(NvpGameEvents.OnMainStarted, OnMainStarted);
 }
Exemplo n.º 18
0
 public void Nochmal_Spielen()
 {
     NvpEventController.InvokeEvent(NvpGameEvents.OnPlayAgain, this, null);
 }
Exemplo n.º 19
0
    // +++ unity callbacks ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    void Awake()
    {
        _eventModel = new NvpEventModel();

        _instance = this;
    }
Exemplo n.º 20
0
 // Start is called before the first frame update
 void Start()
 {
     NvpEventController.SubscribeToEvent(NvpGameEvents.OnPauseObjectCheck, OnPauseObjectCheck);
 }
Exemplo n.º 21
0
 void OnDisable()
 {
     NvpEventController.UnsubscribeFromEvent(NvpGameEvents.OnPauseObjectCheck, OnPauseObjectCheck);
 }
Exemplo n.º 22
0
    // Start is called before the first frame update
    async void Start()
    {
        await Task.Delay(TimeSpan.FromSeconds(1));

        NvpEventController.InvokeEvent(NvpGameEvents.OnMainStarted, this, 42);
    }
Exemplo n.º 23
0
 private void OnDisable()
 {
     NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler  += GameOver;
     NvpEventController.Events(MyEvent.LevelFinish).GameEventHandler += WinLevel;
 }
Exemplo n.º 24
0
 public void Exit_Option()
 {
     NvpEventController.InvokeEvent(NvpGameEvents.OnExitOption, this, null);
 }
Exemplo n.º 25
0
 public void Option_Game()
 {
     //SceneManager.LoadScene(4);
     NvpEventController.InvokeEvent(NvpGameEvents.OnOptionGame, this, null);
 }
Exemplo n.º 26
0
 private void OnDestroy()
 {
     NvpEventController.Events(MyEvent.PlayerDies).GameEventHandler -= GameOver;;
 }
Exemplo n.º 27
0
 public void Reset_Game()
 {
     //SceneManager.LoadScene(1);
     NvpEventController.InvokeEvent(NvpGameEvents.OnResetGame, this, null);
 }
Exemplo n.º 28
0
 public void Play_Game()
 {
     //SceneManager.LoadScene (1);
     NvpEventController.InvokeEvent(NvpGameEvents.OnGameStarted, this, null);
 }