コード例 #1
0
    /// <summary>
    /// Function that creates the visual representation of a World Point class.
    /// </summary>
    /// <param name="wp">Reference to the World Point to be created.</param>
    void CreateWorldPoint(WorldPoint wp)
    {
        /// Instantiate the World Point point prefab as a child of the world sphere (As new GameObject)
        GameObject pivot = Instantiate(worldPointPrefab, worldSphere.transform);

        /// Use the World Point coordinates to rotate the New GameObject in euler angles.
        pivot.transform.eulerAngles = new Vector3(wp.y, -wp.x, 0);
        /// Name the New GameObject
        pivot.name = wp.name;
        /// Set the target transform of the reference World Point.
        wp.SetTarget(pivot.transform.GetChild(0));
        /// Change the color of the new Game Object's renderer.
        pivot.GetComponentInChildren <Renderer>().material.color = wp.color;
    }