Esempio n. 1
0
        public bool HasSlotsForDecoration(ShopDecorationObject decorationObjectToTest)
        {
            bool result = allShopDecorationSlots.Count(x => x.IsFreeAndAssignableTo(decorationObjectToTest)) > 0;

            //Debug.Log("Has slots? " + result);
            return(result);
        }
Esempio n. 2
0
 private void EndPlacementContext()
 {
     ResetSlotHighlights();
     currentDraggedDecoration = null;
     currentDraggedSlot       = null;
     startDragSlot            = null;
 }
Esempio n. 3
0
        public void CreateAndStartDragPlacement(ShopDecorationObject prefab, int bonesCost)
        {
            CurrentDecorationCost = bonesCost;
            var newDeco = SpawnNewDecoration(prefab);

            StartDragPlacement(newDeco, true);
        }
Esempio n. 4
0
 public void Free()
 {
     if (!assigned)
     {
         return;
     }
     assigned = false;
     _assignedDecorationObject = null;
 }
Esempio n. 5
0
        private void DeleteDecoration(ShopDecorationObject decoToDelete)
        {
            var assignedSlot = allShopDecorationSlots.FirstOrDefault(x => x.HasCurrentlyAssigned(currentDraggedDecoration));

            if (assignedSlot != null)
            {
                assignedSlot.Free();
            }
            Destroy(decoToDelete.gameObject);
        }
Esempio n. 6
0
        private ShopDecorationObject SpawnNewDecoration(ShopDecorationObject UnlockableDecorationPrefab)
        {
            if (!HasSlotsForDecoration(UnlockableDecorationPrefab))
            {
                return(null);
            }

            var newDecoration = Instantiate(UnlockableDecorationPrefab);

            newDecoration.transform.localPosition = new Vector3(10000, 0, 0);
            newDecoration.Initialise(slotFeedbackPrefabGo);
            return(newDecoration);
        }
Esempio n. 7
0
 public void Assign(ShopDecorationObject assignedDecorationObject)
 {
     if (assigned)
     {
         return;
     }
     assigned = true;
     _assignedDecorationObject = assignedDecorationObject;
     _assignedDecorationObject.transform.SetParent(transform);
     _assignedDecorationObject.transform.localEulerAngles = Vector3.zero;
     _assignedDecorationObject.transform.localPosition    = Vector3.zero;
     _assignedDecorationObject.transform.SetLocalScale(1);
     _assignedDecorationObject.gameObject.SetActive(true);
 }
Esempio n. 8
0
        public void StartDragPlacement(ShopDecorationObject decoToDrag, bool isNew)
        {
            if (isNew)
            {
                SetContextNewPlacement();
            }
            else
            {
                SetContextMovingPlacement();
            }

            currentDraggedSlot       = null;
            currentDraggedDecoration = decoToDrag;
            currentDraggedDecoration.FocusHighlight(true);
            dragCoroutine = StartCoroutine(DragPlacementCO());

            if (OnDragStart != null)
            {
                OnDragStart(decoToDrag);
            }
        }
Esempio n. 9
0
 private void HandleDragStart(ShopDecorationObject decorationObject)
 {
     isDragging     = true;
     iconUI.texture = decorationObject.rawImage.texture;
 }
Esempio n. 10
0
 public bool HasCurrentlyAssigned(ShopDecorationObject decorationObject)
 {
     return(_assignedDecorationObject == decorationObject);
 }
Esempio n. 11
0
 public bool IsAssignableTo(ShopDecorationObject decorationObject)
 {
     return(slotType == decorationObject.slotType);
 }
Esempio n. 12
0
 public bool IsFreeAndAssignableTo(ShopDecorationObject decorationObject)
 {
     return(!assigned && IsAssignableTo(decorationObject));
 }