/// <summary>
 /// Set the color of the game object and any related child objects
 /// </summary>
 /// <param name="color"></param>
 private void SetColor(Color color)
 {
     if (snowmanAccessory != null)
     {
         GetComponent <Renderer>().material.SetColor("desiredColor", color);
         snowmanAccessory.SetColor(color);
         currentDisplayColor = color;
     }
 }
예제 #2
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");
         }
     }
 }