コード例 #1
0
    public void executeGameover()
    {
        gamestate = Gamestate.gameOver;

        //Debug.LogWarning("executeGameover");

        if (gamesPlayedCounter != null)
        {
            gamesPlayedCounter.increase(1);                     //log the number of played games
        }

        valueManager.instance.saveAllMinMaxValues();                            //save min and max values for all values for the statistics tab
        if (HighScoreNameLinkerGroup.instance != null)
        {
            HighScoreNameLinkerGroup.instance.generateLinks();
        }
        CardStack.instance.resetCardStack();                                            //reset the card stack
        CardStack.instance.clearFollowUpStack();

        saveGameState();
        string currentSceneName = SceneManager.GetActiveScene().name;

        OnGameOver.Invoke();

        SceneManager.LoadScene(currentSceneName);                                                       //reload the scene for a clean startup of the game
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: carlesvallve/Tiler
 public override void GameOver()
 {
     if (OnGameOver != null)
     {
         OnGameOver.Invoke();
     }
 }
コード例 #3
0
 private void onGameOverExecuteLogic()
 {
     if (r_BoardManager.IsAllCellsUncovered() && OnGameOver != null)
     {
         OnGameOver.Invoke();
     }
 }
コード例 #4
0
    private void GameManager_OnGameStateChange(EGameStates GameState)
    {
        switch (GameState)
        {
        case EGameStates.MAIN_MENU:
            OnMainMenu?.Invoke();
            break;

        case EGameStates.CONNECTING:
            break;

        case EGameStates.RELOADING_ROUND:
            break;

        case EGameStates.LOADING_NEXTROUND:
            OnRoundBegin.Invoke();
            break;

        case EGameStates.LOADING_REMATCH:
            break;

        case EGameStates.GAMEPLAY:
            OnGameplayBegin?.Invoke();
            break;

        case EGameStates.ROUND_OVER:
            OnRoundOver.Invoke();
            break;

        case EGameStates.GAME_OVER:
            OnGameOver.Invoke();
            break;
        }
    }
コード例 #5
0
 private void Win()
 {
     state = State.Won;
     WinScreen.SetActive(true);
     OnGameOver.Invoke(true);
     SaveData.GetInstance().SetMaxLevelReached(nextLevel);
 }
コード例 #6
0
 public static void OnGameOverInvoke(object sender = null)
 {
     if (OnGameOver != null)
     {
         OnGameOver.Invoke(null, EventArgs.Empty);
     }
 }
コード例 #7
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Enemy"))
     {
         transform.gameObject.SetActive(false);
         OnGameOver.Invoke(false);
     }
 }
コード例 #8
0
    public void GameOver()
    {
        IsGameOver = true;
        OnGameOver.Invoke();

        gameOverUI.SetActive(true);
        Time.timeScale = 0f;
    }
コード例 #9
0
ファイル: Earth.cs プロジェクト: lynkx21/moon-shield
 private void GameOver()
 {
     if (OnGameOver != null)
     {
         OnGameOver.Invoke();
     }
     sfxManager.PlaySound(sfxManager.earthExplosionClip);
     Destroy(gameObject);
 }
コード例 #10
0
 //Check
 public void WinCheck(CharController target, int score, bool playerBool)
 {
     if (LevelManager.Instance.levelGoal <= score)
     {
         WinSequence(target.transform, playerBool);
         OnGameOver += target.GetComponent <SimpleCharacterControl>().FinishedAnimation;
         OnGameOver.Invoke();
     }
 }
コード例 #11
0
ファイル: GameManager.cs プロジェクト: VladislavLee/stack-ar
 private void Awake()
 {
     // Make the game run as fast as possible. Avoids setting to default frame rate on device.
     Application.targetFrameRate = 300;
     gameMode = GetComponent <GameMode>();
     PlayerData.Create();
     GameInitialized += delegate { OnGameIntialized.Invoke(); };
     GameStarted     += delegate { OnGameStarted.Invoke(); };
     GameOver        += delegate { OnGameOver.Invoke(); };
 }
コード例 #12
0
    public static void KillCitizen(bool hasFinished)
    {
        if (!IsAlive)
        {
            return;
        }

        instance.activeCitizenCount--;

        if (hasFinished)
        {
            instance.hitpointCount--;

            if (OnCitizenFinished != null)
            {
                OnCitizenFinished.Invoke();
            }

            if (instance.hitpointCount == 0)
            {
                instance.isPlaying = false;

                if (OnGameOver != null)
                {
                    OnGameOver.Invoke();
                }

                return;
            }
        }

        if (instance.activeCitizenCount == 0)
        {
            instance.isPlaying = false;

            instance.treeBatches[instance.currentWaveIndex - 1].FadeOut();

            instance.houseBatches[instance.currentWaveIndex - 1].SetActive(true);

            instance.pavements[instance.currentWaveIndex - 1].SetActive(true);

            if (OnWaveEnded != null)
            {
                OnWaveEnded.Invoke();
            }

            if (!HasWavesLeft)
            {
                if (OnGameOver != null)
                {
                    OnGameOver.Invoke();
                }
            }
        }
    }
コード例 #13
0
 public void HealthLoss()
 {
     if (life > 0)
     {
         life--;
         OnHealthLoss.Invoke();
         if (life == 0)
         {
             OnGameOver.Invoke();
         }
     }
 }
コード例 #14
0
    //---------------------GAME OVER -------------------------\\
    public void GameOver()
    {
        if (_isGameOver)
        {
            return;
        }

        _isGameOver = true;

        if (OnGameOver != null)
        {
            OnGameOver.Invoke();
        }
    }
コード例 #15
0
        public HitResult HitCheck(int ballColorId, int targetColorId)
        {
            HitResult hitResult;

            if (ballColorId == targetColorId)
            {
                playerState.Regen();
                scoreKeeper.IncrementCurrentScore(playerState.Combo);
                hitResult = new HitResult {
                    successfulHit = true, playerDead = false
                };
                OnSuccessfulHit?.Invoke();
            }
            else
            {
                playerState.TakeDamage();
                OnDamage?.Invoke();

                if (playerState.IsDead)
                {
                    GameState = GameState.GameOver;
                    OnGameOver?.Invoke();

                    hitResult = new HitResult {
                        successfulHit = false, playerDead = true
                    };
                }
                else
                {
                    hitResult = new HitResult {
                        successfulHit = false, playerDead = false
                    };
                }
            }

            OnHit?.Invoke();
            return(hitResult);
        }
コード例 #16
0
ファイル: VolcanoGame.cs プロジェクト: skotz/volcanoes
        public void MakeMove(int move)
        {
            if (CurrentState.IsValidMove(move))
            {
                bool growthHappened = CurrentState.MakeMove(move);

                MoveHistory.Add(move);
                if (growthHappened)
                {
                    MoveHistory.Add(Constants.AllGrowMove);
                }
                OnMoveMade?.Invoke(growthHappened);

                if (CurrentState.State == GameState.GameOver)
                {
                    OnGameOver?.Invoke(CurrentState.Winner, CurrentState.Winner == Player.Draw ? VictoryType.InfiniteEruption : VictoryType.AntipodePathCreation);
                }
                else
                {
                    ComputerPlay();
                }
            }
        }
コード例 #17
0
    /// <summary>
    /// Call this method when player is dead
    /// </summary>
    private void PlayerController_OnPlayerDied()
    {
        _totalLife--;
        if (_totalLife < 0)
        {
            _totalLife = 0;
        }
        OnUpdatePlayerLife?.Invoke(_totalLife);
        OnRegroupEnemy?.Invoke();

        if (_action != null)
        {
            StopCoroutine(_action);
        }

        if (_totalLife <= 0)
        {
            _isGameActive = false;
            _isPause      = true;
            _isGameOver   = true;
            _isAttackAble = false;

            if (_currentScore > _highScore)
            {
                _highScore = _currentScore;
                GameData.UpdateHighScore(this, _highScore);
            }

            OnGameOver?.Invoke();
        }
        else
        {
            _isAttackAble = false;
            OnGameRetry?.Invoke();
        }
    }
コード例 #18
0
ファイル: Game.cs プロジェクト: Pieliesdie/Practice-2019
        void CheckBulletsCollisions()
        {
            List <GameObj> outofrange = new List <GameObj>();

            foreach (GameObj i in bullets.Concat(user.bullets))
            {
                if (checkWalls(i, out GameObj col))
                {
                    if (col.name == "wall")
                    {
                        outofrange.Add(i);
                        var boom = new GameObj(i.pos, exploisonsSize, animation: GetListFromImage(boomSprite, new Size(39, boomSprite.Height), 7), once: true)
                        {
                            name = "animation"
                        };
                        animations.Add(boom);
                        if (col.CanDestroy == true)
                        {
                            walls.Remove(col);
                        }
                    }
                }

                if (i.HitBox.IntersectsWith(user.HitBox) && i.name == "enemybullet")
                {
                    OnGameOver?.Invoke();
                    break;
                }
                if (CheckBounds(i))
                {
                    outofrange.Add(i);
                }
            }
            outofrange.ForEach(x => bullets.Remove(x));
            outofrange.ForEach(x => user.bullets.Remove(x));
        }
コード例 #19
0
    public static void Damage()
    {
        if (!IsAlive)
        {
            return;
        }

        instance.hitpointCount--;

        if (OnCitizenFinished != null)
        {
            OnCitizenFinished.Invoke();
        }

        if (instance.hitpointCount == 0)
        {
            instance.isPlaying = false;

            if (OnGameOver != null)
            {
                OnGameOver.Invoke();
            }
        }
    }
コード例 #20
0
    public void ChangeGameState(EGameStates NewGameState)
    {
        gameState = NewGameState;
        CustomEvent.Trigger(gameObject, "_OnGamestateChange", NewGameState);

        OnGamestateChange?.Invoke(NewGameState);
        switch (gameState)
        {
        case EGameStates.GameBegin:
            OnGameBegin?.Invoke();

            break;

        case EGameStates.MainMenu:
            OnGameOver?.Invoke();

            break;

        case EGameStates.RoundOver:
            OnRoundOver?.Invoke();

            break;
        }
    }
コード例 #21
0
 private void PlayerDied()
 {
     OnGameOver?.Invoke(GameOverReason.PlayedDied);
 }
コード例 #22
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (timeSlow)
            {
                timeSlow            = false;
                Time.timeScale      = 1f;
                Time.fixedDeltaTime = 0.02f;
            }
            else
            {
                timeSlow            = true;
                Time.timeScale      = slowTimeSpeed;
                Time.fixedDeltaTime = 0.02f * slowTimeSpeed;
            }
        }
        if (transform.position.y < -10 || Input.GetKeyDown(KeyCode.R))
        {
            transform.rotation = Quaternion.identity;
            sphereRB.velocity  = Vector3.zero;
            sphereRB.drag      = normalDrag;

            sphereRB.gameObject.transform.position = startPos;
            transform.position = startPos;

            OnGameOver?.Invoke();
            Debug.Log("GAME OVER!");
        }

        if (isGrounded && Time.timeScale == 1)
        {
            speed += speedIncrement;
            OnSpeedChange?.Invoke(speed);
            //speedText.text = speed.ToString("F2") + "\nkm/hr";
        }

        isDrifting = Input.GetButton("Jump");

        if (Input.GetKey(KeyCode.X) && nitrousAmt > 0f)
        {
            nitrousAmt            -= .06f;
            nitrousSpeedMultiplier = 2f;
            OnNitrousPickup?.Invoke(-.06f);

            // activate exhaust flames
            foreach (var n in nitrousFX)
            {
                n.gameObject.SetActive(true);
                n.Play();
            }
        }
        else
        {
            nitrousSpeedMultiplier = 1f;

            // deactivate exhaust flames
            foreach (var n in nitrousFX)
            {
                n.Pause();
                n.gameObject.SetActive(false);
            }
        }
    }
コード例 #23
0
 public void BroadcastGameOver()
 {
     OnGameOver?.Invoke();
 }
コード例 #24
0
 void GameOver()
 {
     energyHandler.OnEnergyDepleeted -= GameOver;
     playerInputHandler.DisablePlayerInput();
     OnGameOver?.Invoke();
 }
コード例 #25
0
 private void Start()
 {
     OnGameOver?.Invoke();
 }
コード例 #26
0
 public void PlayerClickBombYeet()
 {
     Debug.Log("u ded");
     OnGameOver?.Invoke();
 }
コード例 #27
0
ファイル: GameManager.cs プロジェクト: Nostalex13/G_Test
 private void GameOver()
 {
     OnGameOver?.Invoke();
     TapController.OnTap += GameStart;
 }
コード例 #28
0
ファイル: EventsManager.cs プロジェクト: Muchovsky/Pong
 public void GameOver() => OnGameOver?.Invoke();
コード例 #29
0
 private void GameOver()
 {
     OnGameOver?.Invoke();
 }
コード例 #30
0
 private void DOgameOver()
 {
     OnGameOver?.Invoke(this, new EventArgs());
 }