private void PlaceSelectedObject()
        {
            currentlySelectedObject.Indestuctable = false;

            if (IsValidPlacement == false)
            {
                GameManager.Instance.DespawnObject(currentlySelectedObject.gameObject);
            }
            else
            {
                currentlySelectedObject.ChangeColor(defaultColor);

                if (currentlySelectedObject.FirstPlacement == false)
                {
                    if (CanStartGame == false)
                    {
                        CanStartGame = true;
                    }

                    currentlySelectedObject.FirstPlacement = true;

                    GameManager.Instance.AddPlant(currentlySelectedObject);
                }
            }

            SetSelectedObject(null);
            GameManager.Instance.HidePlacementSpots();
            IsValidPlacement = false;
        }
Exemplo n.º 2
0
 public void Deselect(Selectable item)
 {
     foreach (var x in item.GetComponents <ISelectable>())
     {
         x.OnDeselect();
     }
     selectedItems.Remove(item);
     item.ChangeColor(Color.clear);
 }
        public void SetSelectedObject(MoneyPlant newSelectedObject)
        {
            currentlySelectedObject = newSelectedObject;

            if (currentlySelectedObject != null)
            {
                currentlySelectedObject.ChangeColor(invalidPlacementColor);
            }

            GameManager.Instance.ShowPlacementSpots();
        }
Exemplo n.º 4
0
    public void UnHover(Selectable item)
    {
        if (!hoveredItems.Contains(item))
        {
            return;
        }

        if (!selectedItems.Contains(item))
        {
            item.ChangeColor(Color.clear);
        }
        hoveredItems.Remove(item);
    }
Exemplo n.º 5
0
    public void Hover(Selectable hoveredItem)
    {
        if (!isEnabled)
        {
            return;
        }

        if (hoveredItems.Contains(hoveredItem))
        {
            return;
        }

        hoveredItems.Add(hoveredItem);
        if (!selectedItems.Contains(hoveredItem))
        {
            hoveredItem.ChangeColor(highlightColor);
        }
    }
Exemplo n.º 6
0
 // Unit cannot move or attack but selector is still active (used for death animation)
 internal void FinishUnit()
 {
     moveIsDone   = true;
     actionIsDone = true;
     unitSelectable.ChangeColor(2);
 }