private void OnTriggerEnter(Collider col) { if (col.tag == "END_CHECK_POINT") { // Spawn a new Pattern EndlessManager.Instance.SpawnNextPattern(); // Turn off the current pattern after a few second EndlessEntity entity = col.GetComponentInParent <EndlessEntity>(); if (entity) { entity.Kill_Pattern_After_Delay(4); } } if (col.tag == "OBSTACLE") { SpawnObstacleParticle(transform.position); this.enabled = false; MyGameManager.Instance.EndGame(score); } if (col.tag == "ENEMY") { this.enabled = false; MyGameManager.Instance.EndGame(score); } }
public void SpawnPattern(PatternType type) { // Create Pattern GameObject go = ObjectPoolingManager.Instance.Spawn_A_Specific_PatternPrefab(type, Vector3.zero); // Spawn at latest->next go.transform.position = latest_Pattern_Script.Get_Next_Pattern_Spawn_Position(); // Record down new latest latest_Pattern_Script = go.GetComponent <EndlessEntity>(); }
void Start() { // Need to do this, to tell where is the first pattern->next spawn point latest_Pattern_Script = first_Pattern_Script; // Spawn "n" x Pattern for (int i = 0; i < initial_spawn_count; ++i) { SpawnNextPattern(); } }