public void CompleteOperation(MovesWithMouse.Movable movableType, bool success) { switch (movableType) { case MovesWithMouse.Movable.Ground: if (_status == BlockStatus.GreenSelected) { _status = success ? BlockStatus.Brown : BlockStatus.Green; _image.sprite = success ? brownSprite : greenSprite; if (success) { GameManager.IncrementGroundCounter(); } EnableOutline(false); } break; case MovesWithMouse.Movable.Wheat: if (_status == BlockStatus.BrownSelected) { _status = success ? BlockStatus.Grows : BlockStatus.Brown; _wheat.StartGrowing(() => _status = BlockStatus.Grown); EnableOutline(false); } break; } }
private void ActuallyFinishOperation(MovesWithMouse.Movable movableType) { // Handle holding mouse over empty space as cancelling the operation bool objectOverAnyBlock = _blocks.Any(block => block.ObjectOverBlock); // Debug.Log($"Operation finished, anyMouseOver: {objectOverAnyBlock}"); foreach (var block in _blocks) { block.CompleteOperation(movableType, objectOverAnyBlock); } }
public static void FinishOperation(MovesWithMouse.Movable movableType) { _instance.ActuallyFinishOperation(movableType); }