public static SaladFactory GetInstance() { if (_instance == null) { _instance = new SaladFactory(); } return(_instance); }
private void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); vegetableFactory = VegetableFactory.GetInstance(); saladFactory = SaladFactory.GetInstance(); orderMenu = vegetableFactory.GetCatalog(); vegetableKeys = orderMenu.Keys.ToArray(); }
public bool MixSalad(IProcessable processable) { var vegetable = (IVegetable)processable; if (vegetable != null && vegetable.currentState.HasFlag(ProcessingState.CHOPPED)) { if (currentSalad == null) { saladSprite.enabled = true; currentSalad = SaladFactory.GetInstance().GetSalad(); } currentSalad.currentMix.Add(vegetable); return(true); } else { Debug.LogError("Only chopped vegetables can be mixed into salad"); return(false); } }