示例#1
0
        public void DeleteMisale(Fire misale)
        {
            Console.ForegroundColor = misale.Color;
            Console.BackgroundColor = ConsoleColor.White;

            char symbol = ' ';

            Console.SetCursorPosition(misale.OldCol, misale.OldRow);
            Console.Write(symbol);

            Console.ResetColor();
        }
示例#2
0
        public static Fire Shoot(Tank player, Tank enemy, Random rand)
        {
            int shotChance = rand.Next(1, 101);
            Fire fire = null;

            if (shotChance < 13)
            {
                fire = new Fire(enemy);
            }

            return fire;
        }
示例#3
0
        public NewPosition(Fire misale)
        {
            this.Row = misale.CurrentRow;
            this.Column = misale.CurrentCol;

            ChangeCordinate(misale.Direction);
        }
示例#4
0
        public bool HaveShotCollision(Fire fire, Tank player, List<Tank> enemies)
        {
            // if have collision return true
            // else return false - misale continue move

            // Gencho make simple collision

            NewPosition newFirePosition = new NewPosition(fire);
            if (!CanFireMove(newFirePosition.Row, newFirePosition.Column))
            {
                return true;
            }

            if (newFirePosition.Row >= 2 && newFirePosition.Row < Data.GetWindowHeight() - 2 &&
                newFirePosition.Column >= 0 && newFirePosition.Column < Data.GetWindowWidth() - 1)
            {
                // enemy fire
                if (!fire.IsPlayerFire)
                {
                    if (IsMisaleHitTank(player, newFirePosition))
                    {
                        player.IsHited = true;
                        return true;
                    }
                }
                else
                {
                    bool haveHit = false;
                    for (int i = 0; i < enemies.Count; i++)
                    {
                        if (IsMisaleHitTank(enemies[i], newFirePosition))
                        {
                            enemies[i].IsHited = true;
                            haveHit = true;
                        }
                    }

                    if (haveHit)
                    {
                        return true;
                    }
                }

                return false;
            }

            return true;

            //if (IsFireAgainstEnemy(fire))
            //{
            //}
            //if (IsFireAgainstPlayer(fire))
            //{
            //}
            //if (IsFireAgainstTerain(fire))
            //{
            //}
        }
示例#5
0
        public void Misale(Fire misale)
        {
            DeleteMisale(misale);

            Console.ForegroundColor = misale.Color;
            Console.BackgroundColor = ConsoleColor.White;

            char symbol = misale.Symbol;

            Console.SetCursorPosition(misale.CurrentCol, misale.CurrentRow);
            Console.Write(symbol);

            Console.ResetColor();
        }