Exemplo n.º 1
0
 public void AddToObjList(GameObject obj)
 {
     //if (!objs.Contains(obj)) objs.Add(obj);
     Enemy.Slime s = obj.GetComponent <Enemy.Slime>();
     if ((s.ColorData == color))
     {
         audio[0].Play();
         KRaB.Enemy.Colors.EnemyColor c = s.ColorData - color;
         if (c == (MonoBehaviour)null)
         {
             if (!Manager.GameMaster.Instance.isQuitting)
             {
                 if (Random.Range(0f, 1f) < healthDropRatio)
                 {
                     Instantiate(healthDropPrefab, obj.GetComponent <Transform>().position, GetComponent <Transform>().rotation);
                 }
             }
             Destroy(obj);
             return;
         }
         s.ColorData = c;
     }
     audio[1].Play();
     obj.GetComponent <Enemy.Slime>().ApplyRejectForce();
 }
Exemplo n.º 2
0
 private IEnumerator spawnEnemies(AIMaster parent)
 {
     Debug.Log("Spawn start");
     while (spawning && parent == this.parent)
     {
         if (parent.spawn)
         {
             KRaB.Enemy.Colors.EnemyColor m = possibleSpawns[Random.Range(0, possibleSpawns.Length)];
             GameObject temp = Instantiate(enemy);
             temp.GetComponent <Slime>().ColorData = m;
             temp.transform.position = transform.position;
         }
         yield return(new WaitForSeconds(enemySpawnDelay.RandomInRange));
     }
 }
Exemplo n.º 3
0
 // Use this for initialization
 protected override void Start()
 {
     base.Start();
     ColorData = colorData;
     audio     = GetComponent <AudioSource>();
 }