Exemple #1
0
 /// <summary>
 /// A message called when a collider enters this object's trigger.
 /// </summary>
 /// /// <param name="col">
 /// The other collider.
 /// </param>
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "LocalPlayer")
     {
         drupalUnityIO.SelectPlacard(placard);
     }
 }
    /// <summary>
    /// A method to generate placard objects for each of the placards received.
    /// </summary>
    void GeneratePlacards()
    {
        int count = 0;

        foreach (Placard p in placards)
        {
            count++;
            Placard placard = p; //capture the iterator; otherwise you always get last placard
            if (!nonMovingPlacardIDs.Contains(placard.id))
            {
                GameObject newPlacard = (GameObject)Instantiate(placardPrefab, Vector3.zero, Quaternion.identity);
                newPlacard.transform.position = GeographicManager.Instance.GetPosition(placard.location.latitude, placard.location.longitude, placard.location.elevation);
                newPlacard.transform.rotation.eulerAngles.Set(0f, (float)placard.location.orientation, 0f);
                newPlacard.GetComponent <RectTransform>().SetParent(transform, true);
                newPlacard.GetComponent <PlacardObject>().placard = placard;
                newPlacard.GetComponent <Text>().text             = "#" + count;
                placardObjects.Add(newPlacard);
                EventTrigger       trigger = newPlacard.GetComponent <EventTrigger>();
                EventTrigger.Entry entry   = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerClick;
                entry.callback.AddListener((e) => { drupalUnityIO.SelectPlacard(placard); });
                trigger.triggers.Add(entry);
            }
        }
    }