コード例 #1
0
        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:"));
        }
コード例 #2
0
        private void TryToFindGoldBar()
        {
            var randomResult = Random.Range(0f, 1f);

            if (randomResult < FindGoldBarChance)
            {
                _performer.Invoke(new SpawnGoldBar(_data.CellController.PositionIndex));
            }
        }
コード例 #3
0
        protected override void Refresh()
        {
            base.Refresh();
            _amount.text = _controller.GoldAmount.ToString();

            if (_controller.GoldAmount >= _controller.GoldGoalAmount)
            {
                _performer.Invoke(new EndGame());
            }
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
 private void Start()
 {
     CreateObjects();
     _performer.Invoke(new LoadGame());
 }
コード例 #6
0
 private void OnMouseUp()
 {
     _performer.Invoke(new Dig(_controller));
 }