コード例 #1
0
 private void BallWithGhosts()
 {
     GameObject[] ghosts = GameObject.FindGameObjectsWithTag("ghost");
     for (int index = 0; index < ghosts.Length; index++)
     {
         Ghost            gCls     = ghosts[index].GetComponent <Ghost>();
         List <GhostNode> vertices = gCls.vertices;
         if (vertices != null)
         {
             for (int i = 0; i < vertices.Count; i++)
             {
                 float distance = Vector3.Distance(transform.position, vertices[i].position);
                 if (distance <= Mathf.Abs(ghostRadius))
                 {
                     Vector3 vBall = new Vector3(connonBall.vX, -connonBall.vY, 0);
                     gCls.BallCollision(i, vBall);
                     Destroy(gameObject);
                     return;
                 }
             }
         }
     }
 }