Пример #1
0
        public void ResetBotsUnderCanvas(Unit unit)
        {
            IEnumerator <BotViewer> enumerator = _bots.GetEnumerator();

            while (enumerator.MoveNext())
            {
                BotViewer botViewer = enumerator.Current;

                if (botViewer == null)
                {
                    continue;
                }

                bool overMoveY = botViewer.GetPosition()
                                 .y
                                 .CompareTo(-managerCanvas.YMax)
                                 .Equals(-1);

                bool overMoveX = Mathf.Abs(botViewer.GetPosition()
                                           .x)
                                 .CompareTo(managerCanvas.XMax)
                                 .Equals(1);

                if (overMoveY || overMoveX)
                {
                    botViewer.UpdateState();
                }

                if (overMoveY && !botViewer.GetTrap())
                {
                    _counter.Value++;
                }
            }

            enumerator.Dispose();
        }
Пример #2
0
        private void ChetHitsBot(Vector2 xPointPosition)
        {
            IEnumerator <BotViewer> enumerator = _bots.GetEnumerator();

            while (enumerator.MoveNext())
            {
                BotViewer botViewer = enumerator.Current;

                float deltaShootBot = Vector3.Distance(botViewer.GetPosition(), xPointPosition);

                if (Mathf.Abs(deltaShootBot) > botViewer.GetHitBox())
                {
                    continue;
                }

                botViewer.UpdateState();

                _counter.Value = botViewer.GetTrap()
                    ? _skipCounter
                    : _counter.Value;
            }

            enumerator.Dispose();
        }