Пример #1
0
        private BuildingStats CreateBuildingStats(string imageName, string BitmapName, IMoveUnitStats UnitToGenerate, float CreationTime, int buildingHealth)
        {
            BuildingStats NewBuilding = new BuildingStats();

            NewBuilding.image = VisibleUnit.AddBitmap(imageName, BitmapName);

            NewBuilding.SetToSpawn(UnitToGenerate);
            NewBuilding.CreationTime = CreationTime;
            NewBuilding.health       = buildingHealth;
            return(NewBuilding);
        }
Пример #2
0
        private Building CreateBuilding(ref BuildingStats stats, float x, float y)
        {
            Point2D location = new Point2D();

            location.X = x;
            location.Y = y;
            VirtualIntelligence masterAI    = null;
            Building            NewBuilding = new Building(ref stats, location, ref masterAI);

            GameMain.DrawList.Add(NewBuilding);
            _grid.Add(location, NewBuilding);
            //_allUnits.Add (NewBuilding);
            return(NewBuilding);
        }
Пример #3
0
 public Building(ref BuildingStats BuildingStats, Point2D position, ref VirtualIntelligence Master) : base(BuildingStats.image, position, ref Master, BuildingStats.health)
 {
     _buildingStatsRef = BuildingStats;
     _timer            = 0f;
     _intact           = true;
 }
Пример #4
0
        public GameStats(string MapName)
        {
            object [] Values;
            Values = GetNumbers.GetTheNumbers("Workers", new string [] { "Worker max" }, new object [] { 5 });
            _maxNumberOfWorkers = (int)Values [0];

            StreamReader reader = new StreamReader(Directory.GetCurrentDirectory() + GameMain.MapsFolder + MapName);

            try {
                string currentLine = reader.ReadLine();
                while (currentLine != null)
                {
                    if (currentLine.StartsWith("t"))
                    {
                        GameMain.VILeft++;
                    }
                    currentLine = reader.ReadLine();
                }
            } finally {
                reader.Close();
            }
            _teams = new Stack <TeamAIStats> ();

            //AI stats. How it's going to think
            for (int i = 0; i <= (GameMain.VILeft - 1); i++)
            {
                Random rnd = new Random();
                Values = GetNumbers.GetTheNumbers("Team " + Environment.NewLine + (i + 1).ToString(),
                                                  new string [] { "Worker minimum aim", "Worker to fighter Ratio", "Fighter to worker ratio",
                                                                  "Swordsman to Archer ratio", "Archer to Swordsman ratio" },
                                                  new object [] { rnd.Next(1, 3), rnd.Next(2, 4), rnd.Next(2, 5), rnd.Next(1, 7), rnd.Next(1, 7) });
                if ((int)Values [0] > _maxNumberOfWorkers)
                {
                    Values [0] = _maxNumberOfWorkers;
                }
                newTeamAIStats((int)Values [0], (int)Values [1], (int)Values [2], (int)Values [3], (int)Values [4], BiasNames.Archers);
            }

            //Set worker stats
            Values = GetNumbers.GetTheNumbers("Worker", new string [] { "Cost", "Speed", "MaxHealth", "Resource Carry limit" },
                                              new object[] { 1, 5.75f, 25, 1 });
            _workerStats = CreateWorker((int)Values [0], (float)Values [1], (int)Values [2], (int)Values [3], "Pisk-Worker.png", "WorkerBitmap");

            //Set aggressive stats
            //Swordsman
            Values = GetNumbers.GetTheNumbers("Swordsman", new string [] { "Cost", "Speed", "MaxHealth", "Damage", "Attack range", "Reload time" },
                                              new object [] { 6, 5.5f, 10, 4, 1f, .75f });
            _swordsmanStats = CreateAggressive((int)Values [0], (float)Values [1], (int)Values [2], (int)Values [3], (float)Values [4], (float)Values [5], "Pisk-Melee.png", "SwordsmanBitmap", UnitTypes.Swordsman);
            //Archer
            Values = GetNumbers.GetTheNumbers("Archer", new string [] { "Cost", "Speed", "MaxHealth", "Damage", "Attack range", "Reload time" },
                                              new object [] { 5, 5.5f, 10, 2, 2f, .5f });
            _archerStats = CreateAggressive((int)Values [0], (float)Values [1], (int)Values [2], (int)Values [3], (float)Values [4], (float)Values [5], "Pisk-Ranged.png", "ArcherBitmap", UnitTypes.Archer);

            //home base
            Values = GetNumbers.GetTheNumbers("Home base", new string [] { "Generate Worker length", "Base building health" },
                                              new object [] { 8f, 100 });
            _buildingHome = CreateBuildingStats("Pisk-HomeBase.png", "BaseBitmap", _workerStats, (float)Values [0], (int)Values [1]);

            //Archery
            Values = GetNumbers.GetTheNumbers("Archery", new string [] { "Generate Archer length", "Archery building health" },
                                              new object [] { 8f, 100 });
            _buildingArchery = CreateBuildingStats("Pisk-Archery.png", "ArcheryBitmap", _archerStats, (float)Values [0], (int)Values [1]);

            //Barraks
            Values = GetNumbers.GetTheNumbers("Barraks", new string [] { "Generate Swordsman length", "Barraks building health" },
                                              new object [] { 8f, 100 });
            _buildingBarraks = CreateBuildingStats("Pisk-Barraks.png", "BarraksBitmap", _swordsmanStats, (float)Values [0], (int)Values [1]);
        }