예제 #1
0
        //EDIT: Removed ScoreManager and added score to the player.
        //since the return to pool message is called on enemies when they die, this works
        void UpdateScore(ReturnToPool <EnemyBehaviour> enemy)
        {
            actualScore += enemy.value.PointValue * scoreMultiplier;
            CurrentScore = Mathf.RoundToInt(actualScore);

            enemiesKilled++;
            if (enemiesKilled >= enemiesForMulGain)
            {
                enemiesKilled    = 0;
                scoreMultiplier += scoreMulGain;
                Message <ScoreMultiplierChanged> .Raise(new ScoreMultiplierChanged(scoreMultiplier, scoreMulGain));
            }

            //update score, then update UI
            scoreDisplay.text = CurrentScore.ToScoreString(scoreLength);
        }
예제 #2
0
 void SpawnPowerup(ReturnToPool <EnemyBehaviour> rEnemy)
 {
     //verify spawn
     if (Random.value < spawnChance)
     {
         //Get a random powerup
         var toSpawn = powerups[Random.Range(0, powerups.Length)];
         //initialize object
         var spawned = M_GetPoolObject();
         spawned.transform.position = rEnemy.transform.position;
         //set powerup (also enables the object)
         spawned.Powerup = toSpawn;
         spawnChance     = baseSpawnChance;
     }
     else
     {
         //increase the spawnChance.
         spawnChance += ((1f - baseSpawnChance) / (float)enemyCountToAlwaysSpawn);
     }
 }
예제 #3
0
파일: Pool.cs 프로젝트: Toreole/CLA
 public void ReturnObjectToPool(ReturnToPool <T> obj)
 {
     //print("hello world");
     obj.value.gameObject.SetActive(false);
     pooledObjects.Enqueue(obj);
 }