public static void Main(string[] args) { ICommandPool commandPool = new CommandPool(); commandPool.Register <PrintHello, PrintHelloCommand>(); commandPool.Register <Summarize, SummarizeCommand>(); commandPool.Register <PrintText, PrintTextCommand>(); PerformerFactory factory = PerformerFactory.Instance; IPerformer performer = factory.Create(commandPool); performer.Invoke(new PrintHello()); performer.Invoke(new Summarize()); performer.Invoke(new PrintText("Print this text, pls! c:")); }
private void TryToFindGoldBar() { var randomResult = Random.Range(0f, 1f); if (randomResult < FindGoldBarChance) { _performer.Invoke(new SpawnGoldBar(_data.CellController.PositionIndex)); } }
protected override void Refresh() { base.Refresh(); _amount.text = _controller.GoldAmount.ToString(); if (_controller.GoldAmount >= _controller.GoldGoalAmount) { _performer.Invoke(new EndGame()); } }
private IEnumerator DraggingCoroutine() { while (_isDragging) { Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); transform.localPosition = mousePosition; yield return(null); } if (IsInBag) { _performer.Invoke(new CollectGold(_controller)); } else { transform.localPosition = _initialPosition; } }
private void Start() { CreateObjects(); _performer.Invoke(new LoadGame()); }
private void OnMouseUp() { _performer.Invoke(new Dig(_controller)); }