예제 #1
0
 void OnTriggerEnter(Collider other)
 {
     Debug.Log("enter");
     if (other.CompareTag("FancyBullet"))
     {
         oscSender.decreaseEnemy();
         bulletController = other.gameObject.GetComponent <bulletController>();
         bulletController.getIdx();
         float posX = this.transform.position.x;
         float posZ = this.transform.position.z;
         int[] res  = findNearest(posX, posZ, 15);
         if (res[1] == 0)
         {
             oscSender.setRhythmTemplate(bulletController.getIdx(), res[0] / 2 + 1);
             GameObject oldSequenceEnemy = oscSender.getRhythmObject(bulletController.getIdx());
             if (oldSequenceEnemy == null)
             {
                 GameObject sequenceEnemy = Instantiate(SequenceEnemy, getSequenceLocation(bulletController.getIdx(), 25f, 0), Quaternion.identity) as GameObject;
                 sequenceEnemy.transform.eulerAngles = new Vector3(sequenceEnemy.transform.eulerAngles.x, sequenceEnemy.transform.eulerAngles.y - 90f, sequenceEnemy.transform.eulerAngles.z);
                 oscSender.setRhythmObjects(sequenceEnemy, bulletController.getIdx());
             }
             else
             {
                 sequenceEnemyController sec = oldSequenceEnemy.GetComponent <sequenceEnemyController>();
                 sec.setSequencePos(new int[] { bulletController.getIdx(), 0 });
             }
         }
         else
         {
             oscSender.setMelodyTemplate(bulletController.getIdx(), res[0]);
             GameObject oldSequenceEnemy = oscSender.getMelodyObjects(bulletController.getIdx());
             if (oldSequenceEnemy == null)
             {
                 GameObject sequenceEnemy = Instantiate(SequenceEnemy, getSequenceLocation(bulletController.getIdx(), 25f, 1), Quaternion.identity);
                 sequenceEnemy.transform.eulerAngles = new Vector3(sequenceEnemy.transform.eulerAngles.x, sequenceEnemy.transform.eulerAngles.y - 90f, sequenceEnemy.transform.eulerAngles.z);
                 oscSender.setMelodyObjects(sequenceEnemy, bulletController.getIdx());
             }
             else
             {
                 sequenceEnemyController sec = oldSequenceEnemy.GetComponent <sequenceEnemyController>();
                 sec.setSequencePos(new int[] { bulletController.getIdx(), 1 });
             }
         }
         Destroy(other.gameObject);
         DestorySelf();
     }
 }
예제 #2
0
 void OnTriggerEnter(Collider other)
 {
     //Debug.Log("enter");
     if (other.CompareTag("FancyBullet"))
     {
         if (sequencePos[1] == 0)
         {
             oscSender.setRhythmTemplate(sequencePos[0], 0);
         }
         else
         {
             oscSender.setMelodyTemplate(sequencePos[0], 0);
         }
         Destroy(other.gameObject);
         DestorySelf();
     }
 }