Esempio n. 1
0
    void SpawnPowerup()
    {
//		Debug.Log("SpawnPowerup");
        PowerUpSpawnPoint spawnPoint = spawnPoints[Random.Range(0, spawnPoints.Length)].GetComponent <PowerUpSpawnPoint>();

        if (spawnPoint.isAvailable)
        {
            GameObject powerup = Instantiate(powerups [Random.Range(0, powerups.Length - 1)]);

            powerup.transform.position = spawnPoint.gameObject.transform.position;
            powerup.transform.LookAt(Vector3.zero);
        }
    }
Esempio n. 2
0
	protected override void OnTriggerEnter(Collider other) {
		if (other.gameObject.tag == "Player") {
			spawnPoint.isAvailable = true;

			other.gameObject.AddComponent<InfiniteBoostModifier> ();
			Destroy (gameObject);

		} else if (other.gameObject.tag == "PowerUpSpawnPoint") {

			spawnPoint = other.gameObject.GetComponent<PowerUpSpawnPoint> ();
			spawnPoint.isAvailable = false;
		}
	}
 void Spawn(PowerUpSpawnPoint point)
 {
     if (point.occupier == null)
     {
         PowerupType type = point.possibleTypes[Random.Range(0, point.possibleTypes.Length)];
         PowerUp powerUp = (Instantiate(powerupPrefabsForTypes[(int)type],
                                        point.transform.position,
                                        Quaternion.Euler(90f, 0f, 0f)) as GameObject).GetComponent<PowerUp>();
         powerUp.type = type;
         powerUp.spawnPoint = point;
         powerUp.transform.parent = powerUp.transform;
         point.occupier = powerUp;
     }
 }
Esempio n. 4
0
    protected override void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            spawnPoint.isAvailable = true;

            other.gameObject.AddComponent <InfiniteBoostModifier> ();
            Destroy(gameObject);
        }
        else if (other.gameObject.tag == "PowerUpSpawnPoint")
        {
            spawnPoint             = other.gameObject.GetComponent <PowerUpSpawnPoint> ();
            spawnPoint.isAvailable = false;
        }
    }