示例#1
0
    void Start()
    {
        PacDot.Count = 0;
        for (int y = 0; y < PathNodes.self.height; y++)
        {
            for (int x = 0; x < PathNodes.self.width; x++)
            {
                if (PathNodes.self.nodeSpots[x, y])
                {
                    Collider2D coll = Physics2D.OverlapPoint(new Vector2(x, y));

                    if (coll != null && coll.tag == "Player")
                    {
                        continue;
                    }

                    PacDot pacDot = Instantiate <PacDot>(dotPrefab);
                    pacDot.transform.position = new Vector3(x, y);
                    pacDot.gameObject.SetActive(true);
                    PacDot.Count++;
                    //pacDot.transform.SetParent(transform, true);
                } //if
            }     //for
        }         //for
    }             //Awake
示例#2
0
 public void Initialize(List <IntVector2> pacDotCoordinates, Transform parent)
 {
     PacDot = new List <PacDot>();
     foreach (IntVector2 PacDotCoordinate in pacDotCoordinates)
     {
         PacDot instance = Instantiate(PacDotPrefab) as PacDot;
         instance.transform.SetParent(parent);
         instance.Initialize(PacDotCoordinate);
         PacDot.Add(instance);
     }
 }