Пример #1
0
        public override void Render(SpriteBatch spriteBatch)
        {
            if (Support.GlobalVars.playerDebug)
            {
                // Shows the Adjacent cells in player debug mode
                foreach (Edge edge in InCell.Adjecent)
                {
                    edge.Cell1.TileColor = edge.Cell2.TileColor = Color.Green;
                    edge.Cell1.Render(spriteBatch);
                    edge.Cell2.Render(spriteBatch);
                    edge.Cell1.TileColor = edge.Cell2.TileColor = Color.White;
                }

                if (Target != null)
                {
                    Target.TileColor = Color.Red;
                    Target.Render(spriteBatch);
                }

                InCell.TileColor = Color.Red;
                InCell.Render(spriteBatch);
                InCell.TileColor = Color.White;
            }

            spriteBatch.Begin();
            spriteBatch.Draw(_playerTexture, Position.ToVector2(), null, Color.White, playerAngle, origin, 1.0f, SpriteEffects.None, 0f);
            spriteBatch.End();
        }
Пример #2
0
        public void Kill()
        {
            transform.position      = InCell.GetPosition();
            transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, -1);
            gameObject.SetActive(false);

            if (InCell != null)
            {
                InCell.ReleaseCell();
            }
        }
Пример #3
0
        /// <summary>
        /// Ищет разницу исходных данных с фильтром
        /// </summary>
        /// <param name="In">Входные данные</param>
        /// <param name="Filter">Фильтр</param>
        /// <param name="Out">Выходной формат</param>
        /// <returns></returns>
        private DataTable FindDifferences(DataTable In, DataTable Filter, DataTable Out, string FilterName)
        {
            string StatusStr = "Поиск совпадений";
            int    i         = 0;
            int    m         = In.Rows.Count;

            StatusStr = StatusStr = $"{FilterName}: Поиск несовпадающих записей";
            SetStatus(StatusStr, i, m);
            Wait();
            if (Abort)
            {
                return(null);
            }
            // Ищем совпадения
            foreach (DataRow inrow in In.Rows)
            {
                bool Stop = false;
                foreach (object InCell in inrow.ItemArray)
                {
                    foreach (DataRow frow in Filter.Rows)
                    {
                        if (InCell.ToString() == frow.ItemArray[0].ToString())
                        {
                            Stop = true;
                            break;
                        }
                        if (Stop)
                        {
                            break;
                        }
                    }
                    if (Stop)
                    {
                        break;
                    }
                }
                if (!Stop)
                {
                    Out.Rows.Add(inrow.ItemArray);
                }
                SetStatus(StatusStr, i++, m);
                Wait();
                if (Abort)
                {
                    return(null);
                }
            }

            return(Out);
        }
Пример #4
0
        public override void Render(SpriteBatch spriteBatch)
        {
            // Color of the underlying tile shows the current state of the Tank
            // Blue: Patrol, Red: Attack enemy, Yellow: Search player, Green: Create Distance
            if (GlobalVars.debug)
            {
                InCell.TileColor = State.GetColor();
                InCell.Render(spriteBatch);
                InCell.TileColor = Color.White;
            }

            // Render base of the Tank
            spriteBatch.Begin();
            spriteBatch.Draw(_texture, destinationSize, null, Color.White, spriteAngle, origin, SpriteEffects.None, 0f);

            //Render top of the Tank
            spriteBatch.Draw(_tankTopTexture, destinationSize, null, Color.White, AngleTankTurret, tankTopOrigin, SpriteEffects.None, 0f);
            spriteBatch.End();
        }
Пример #5
0
        public void PutInCell(ICell cell)
        {
            if (!cell.IsFree())
            {
                return;
            }

            cell.PutFigure(this);

            if (InCell != null)
            {
                InCell.ReleaseCell();
            }

            InCell = cell;

            transform.position      = InCell.GetPosition();
            transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, -1);

            if (MoveCompleteEventHandler != null)
            {
                MoveCompleteEventHandler();
            }
        }