示例#1
0
 /// <summary>
 /// Adds a game object as a node primitive to the world
 /// </summary>
 /// <param name="snowmanObject"></param>
 public void AddPrimitiveToCurrentNode(GameObject snowmanObject)
 {
     if (snowmanObject != null)
     {
         SnowmanAccessory accessory = snowmanObject.GetComponent <SnowmanAccessory>();
         if (accessory != null)
         {
             snowmanObject.layer = 0; //Change the layer since we no longer want to treat this object as an free object
             snowmanObject.GetComponent <Renderer>().material = stardardObjectMat;
             accessory.UpdateMaterial(stardardObjectMat);
             NodePrimitive primitive = snowmanObject.AddComponent <NodePrimitive>();
             primitive.PrimitiveColor = accessory.PrimaryColor;
             primitive.detectionType  = accessory.DetectionType;
             accessory.SetColor(accessory.PrimaryColor);
             SceneNode node = GetSnowmanSceneNode();
             node.AddPrimitive(primitive);
         }
         else
         {
             Debug.LogError("The object grab is not a valid snowman accessory object");
         }
     }
 }