// Start is called before the first frame update
    void Start()
    {
        snowmanAccessory    = GetComponent <SnowmanAccessory>();
        currentDisplayColor = PrimitiveColor;
        GetComponent <Renderer>().material.SetFloat("transparentObj", snowmanAccessory.ContainerObj ? 0f : 1f);

        Debug.Assert(snowmanAccessory != null); //Expected to be on the object already or added during NodePrimitive creation
    }
Esempio n. 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");
         }
     }
 }