Example #1
0
      public int GetScore()
      {
          int finalScore = 0;

          if (CurrentDifficulty.Equals("easy"))
          {
              Modifier     = 3;
              TimeModifier = 300;
          }
          else if (CurrentDifficulty.Equals("medium"))
          {
              Modifier     = 2;
              TimeModifier = 720;
          }
          else if (CurrentDifficulty.Equals("hard"))
          {
              Modifier     = 4;
              TimeModifier = 900;
          }

          //Score will be time -
          finalScore = TimeModifier - FinalTime;
          if (finalScore < 0)
          {
              return(0);
          }
          else
          {
              return(finalScore * Modifier);
          }
      }
        private IEnumerator CoLeaveScoreCard()
        {
            followingCamera.transform.rotation = virtualFollowingCamera.transform.rotation;

            Vector3 desiredPosition = followingCamera.CalculateTargetPosition();

            if (followingCamera.UseBounds)
            {
                desiredPosition = followingCamera.ConstrainPositionInBounds(desiredPosition);
            }

            virtualFollowingCamera.transform.position = desiredPosition;

            timelineDirector.playableAsset = hideScoreCardTimeline;
            timelineDirector.Play();

            yield return(new WaitForSeconds((float)hideScoreCardTimeline.duration));

            isGamePlayActive = true;
            roundTimer       = 0f;

            RequiredMoney = CurrentDifficulty.ScaledMoneyGoal(currentRound);

            hud.UpdateMoneyText();

            EnableGamePlay();
        }
        private void Start()
        {
            scoreCard = Instantiate(scoreCardPrefab);
            scoreCard.gameObject.SetActive(false);
            gameOverPanel = Instantiate(gameOverPanelPrefab);
            gameOverPanel.gameObject.SetActive(false);

            scoreCard.OnNextRound   += HandleOnNextRound;
            Table.OnTablesDestroyed += HandleOnTablesDestroyed;

            followingCamera = Camera.main.GetComponent <FollowingCamera>();

            RequiredMoney = CurrentDifficulty.ScaledMoneyGoal(currentRound);
            SendNextDifficulty();
        }
Example #4
0
 private void CalculateDifficulty()
 {
     if (gameTimer >= 0 && gameTimer < 30 && currentDifficulty != CurrentDifficulty.VeryEasy)
     {
         currentDifficulty = CurrentDifficulty.VeryEasy;
         spawnDelay        = 3f;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 30 && gameTimer < 60 && currentDifficulty != CurrentDifficulty.Easy)
     {
         currentDifficulty = CurrentDifficulty.Easy;
         spawnDelay        = 2f;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 60 && gameTimer < 90 && currentDifficulty != CurrentDifficulty.Medium)
     {
         currentDifficulty = CurrentDifficulty.Medium;
         spawnDelay        = 1f;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 90 && gameTimer < 120 && currentDifficulty != CurrentDifficulty.MediumHard)
     {
         currentDifficulty = CurrentDifficulty.MediumHard;
         spawnDelay        = 0.5f;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 120 && gameTimer < 150 && currentDifficulty != CurrentDifficulty.Hard)
     {
         currentDifficulty = CurrentDifficulty.Hard;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 150 && gameTimer < 180 && currentDifficulty != CurrentDifficulty.VeryHard)
     {
         currentDifficulty = CurrentDifficulty.VeryHard;
         OnDifficultyChanged();
     }
     else if (gameTimer >= 180 && gameTimer < 210 && currentDifficulty != CurrentDifficulty.Impossible)
     {
         currentDifficulty = CurrentDifficulty.Impossible;
         OnDifficultyChanged();
     }
 }
Example #5
0
    private void SpawnToy(CurrentDifficulty difficulty)
    {
        GameObject toyToSpawn = null;

        //If easy difficulty, spawn only 2-snap toys
        if (currentDifficulty == CurrentDifficulty.VeryEasy)
        {
            //Choose random 2 snap toy
            toyToSpawn = twoSnapToys[Random.Range(0, twoSnapToys.Length)];
        }
        else if (currentDifficulty == CurrentDifficulty.Easy)
        {
            //Choose either 2-snap or 3-snap
            int random = Random.Range(0, 2);

            if (random == 0)
            {
                //spawn 2-snap toy
                toyToSpawn = twoSnapToys[Random.Range(0, twoSnapToys.Length)];
            }
            else if (random == 1)
            {
                //spawn 3-snap toy
                toyToSpawn = threeSnapToys[Random.Range(0, threeSnapToys.Length)];
            }
        }

        if (toyToSpawn != null)
        {
            //Spawn the object and then for each child remove parent
            for (int i = 0; i < toyToSpawn.transform.childCount; i++)
            {
                GameObject toy = Instantiate(toyToSpawn.transform.GetChild(i), spawnPos, Quaternion.identity).gameObject;
                toy.name = toyToSpawn.transform.GetChild(i).name;
            }
        }

        //Reset the spawn timer
        spawnTimer = 0f;
    }