Exemplo n.º 1
0
 private void SpawnAstroid()
 {
     if (AstroidList.Count >= MaxAstroidCount)
     {
         return;
     }
     if (SpawnTimer >= SpawnInterval)
     {
         GameObject obj     = Instantiate(Astroid, transform, false);
         SC_Astroid astroid = obj.GetComponent <SC_Astroid>();
         astroid.MoveSpeed             = Random.Range(AstroidMoveSpeed.min, AstroidMoveSpeed.max);
         astroid.RotateSpeed           = Random.Range(AstroidRotateSpeed.min, AstroidRotateSpeed.max);
         astroid.transform.localScale *= Random.Range(AstroidSizeMultiplier.min, AstroidSizeMultiplier.max);
         obj.transform.position        = transform.position + new Vector3(0, AreaController.SphereRadius + Random.Range(-1, 1), 0);
         AstroidList.Add(astroid);
         SpawnTimer = 0;
     }
     SpawnTimer += Time.deltaTime;
 }
Exemplo n.º 2
0
 public void DestroyAstroid(SC_Astroid astroid)
 {
     AstroidList.Remove(astroid);
     Destroy(astroid.gameObject, 0.1f);
 }