Beispiel #1
0
    // 通過点を作成し情報テキストを表示
    GameObject CreateFlightPoint(Vector3 pos, string flightID)
    {
        GameObject point = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        point.transform.position   = pos;
        point.transform.localScale = new Vector3(pointRadius, pointRadius, pointRadius);
        point.GetComponent <MeshRenderer>().material = pointM;
        point.transform.parent = this.transform;

        GameObject newFlightPoint = new GameObject(flightID);
        Text       pointText      = newFlightPoint.AddComponent <Text>();

        newFlightPoint.transform.SetParent(canvas.transform);
        newFlightPoint.transform.rotation   = new Quaternion(0, 0, 0, 0);
        newFlightPoint.transform.localScale = new Vector3(4, 4, 4);
        newFlightPoint.GetComponent <RectTransform>().pivot = new Vector2(0, 1);

        Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");

        pointText.font          = ArialFont;
        pointText.material      = ArialFont.material;
        pointText.raycastTarget = false;

        ShowPointTag spt = point.AddComponent <ShowPointTag>();

        spt.canvas     = canvas;
        spt.tagText    = pointText;
        pointText.text = flightID;

        return(point);
    }
Beispiel #2
0
    public void CreateWP(Coord bin, bool dynamic = false)
    {
        GameObject segment = Instantiate(prefab);

        segment.transform.parent        = transform;
        segment.name                    = bin.name + bin.Latitude + " " + bin.Longitude + " " + dynamic;
        segment.transform.localPosition = bin.FlatPosition;
        bin.go = segment;


        GameObject newFlightPoint = new GameObject(bin.name);
        Text       pointText      = newFlightPoint.AddComponent <Text>();

        newFlightPoint.transform.SetParent(canvas.transform);
        newFlightPoint.transform.rotation   = new Quaternion(0, 0, 0, 0);
        newFlightPoint.transform.localScale = new Vector3(4, 4, 4);
        newFlightPoint.GetComponent <RectTransform>().pivot = new Vector2(0, 1);

        Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");

        pointText.font          = ArialFont;
        pointText.material      = ArialFont.material;
        pointText.raycastTarget = false;

        ShowPointTag spt = segment.AddComponent <ShowPointTag>();

        spt.canvas     = canvas;
        spt.tagText    = pointText;
        pointText.text = bin.name;

        segment.SetActive(showall != dynamic);
    }