Example #1
0
 public void SetName(String name)
 {
     if (this.name == null)
     {
         this.name = name;
         nameText  = FormattedTextCreator.Create(name, 10);
     }
 }
Example #2
0
        public void UpdateResults()
        {
            int bulletMultiplier   = 20;
            int ramMultiplier      = 1;
            int survivalMultiplier = 10;
            int killMultiplier     = 100;

            String        winner       = "";
            int           highestScore = 0;
            ShipCommander shipWinner   = null;

            String results = "Results\n\n";

            results += "Ship\t\t\tBullet Damage\tRam Damage\tSurvival Bonus\tKill Bonus\tTotal\n";
            results += "---------------------------------------------------------------------------------------------------------------------------------------------------------\n";
            foreach (ShipCommander sc in MainWindow._instance.CommanderList)
            {
                int total = (sc.ship.ScoreProps.BulletDamage * bulletMultiplier) + (sc.ship.ScoreProps.RamDamage * ramMultiplier) + (sc.ship.ScoreProps.SurvivalScore * survivalMultiplier) + (sc.ship.ScoreProps.KillBonus * killMultiplier);
                sc.ship.ScoreProps.Total = total;

                if (total >= highestScore)
                {
                    highestScore = total;
                    winner       = sc.ship.GetName();
                    shipWinner   = sc;
                }

                results += sc.ship.GetName() + "\t\t\t" + (sc.ship.ScoreProps.BulletDamage * bulletMultiplier) + "\t\t" + (sc.ship.ScoreProps.RamDamage * ramMultiplier) + "\t\t" + (sc.ship.ScoreProps.SurvivalScore * survivalMultiplier) + "\t\t" + (sc.ship.ScoreProps.KillBonus * killMultiplier) + "\t\t" + sc.ship.ScoreProps.Total + "\n";
                results += "---------------------------------------------------------------------------------------------------------------------------------------------------------\n";
            }
            results   += "\nWinner: " + winner;
            resultText = FormattedTextCreator.Create(results, 15);
            Console.WriteLine(results);

            if (shipWinner != null)
            {
                shipWinner.ExecuteOnWin();
            }
        }