Exemple #1
0
        private void PlaceOnClic()
        {
            if (Input.GetMouseButtonUp(0))
            {
                //TODO : dragging stuff - make it better
                for (int i = 0; i < draggedBC.Count; i++)
                {
                    if (draggedBC[i].gameObject.activeSelf && ConstraintController.CanPlace(draggedBC[i]))
                    {
                        string name = currentBC.template.name + "_" + (nbObjectsPlaced++);
                        TemplateController.PlaceObject(draggedBC[i], name, BC_State.Blueprint);
                    }
                    else
                    {
                        Destroy(draggedBC[i].gameObject);
                    }
                }
                Destroy(currentBC.gameObject);
                draggingGroup = null;
                draggedBC.Clear();
                UIController.Instance.SetForwardOffset(ForwardOffsetBeforeDragging); // reset ForwardOffset to what it was before dragging - less annoying

                /*
                 * This works for 1 clic :
                 *
                 * if (ConstraintController.CanPlace(currentPlaceableObject))
                 * {
                 *  string name = currentBC.template.name + "_" + (nbObjectsPlaced++) ;
                 *  TemplateController.PlaceObject(ref currentPlaceableObject , name , BC_State.Blueprint) ;
                 * }
                 * else
                 * {
                 *  //Debug.Log("Destroyed currentPlaceableObject "+ currentPlaceableObject .GetInstanceID()+ " as I couldn't place it");
                 *  Destroy(currentPlaceableObject);
                 * }
                 */
            }
        }