Пример #1
0
    /**
     * Hook from interface.
     *
     * Adds furniture from Resources folder to marker origin.
     *
     * Tracks furniture in active list.
     *
     */
    public void PickFurniture(Furniture furniture)
    {
        if (ActiveFurn.Count > MaxFurniture - 1) return;

        GameObject furnPrefab = Resources.Load ("Prefab Models/" + furniture.GetName()) as GameObject;

        GameObject furn = null;

        if (furnPrefab != null) {
            furn = Instantiate(furnPrefab) as GameObject;
            int furnitureLayer = 11; //FOR TESTING
            //furn.layer = LayerMask.NameToLayer("Furniture");
            furn.layer = furnitureLayer;
        }

        if (furn != null) {
            ActiveFurn.Add (furn);
            markerID = (int)camManager.currentMarkerInfo.imageID;
            furn.transform.localScale *= markerScale[markerID];
            furn.transform.localScale = furn.transform.localScale * 1.2f;  //Scale correction
            furn.SetActiveRecursively(true);

            furn.GetComponent<FurnitureData>().furniture = furniture;

            furn.rigidbody.isKinematic = true;

            furn.AddComponent<EmptySpotDropper>();
            //furn.AddComponent<CollisionCheck>();

            AmountFurniture(ActiveFurn.Count);

        } else Debug.LogError("Received invalid furniture name: "+name);
    }