Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        private WorkerStats CreateWorker(int Cost, float Speed, int MaxHealth, int ResourceCarryLimit, string imageName, string BitmapName)
        {
            WorkerStats NewWorker = new WorkerStats();

            NewWorker.UT                  = UnitTypes.Worker;
            NewWorker.cost                = Cost;
            NewWorker.speed               = Speed;
            NewWorker.maxHealth           = MaxHealth;
            NewWorker.spawnType           = typeof(Worker);
            NewWorker.ResourceCarryAmount = ResourceCarryLimit;
            NewWorker.range               = 1f;
            NewWorker.image               = VisibleUnit.AddBitmap(imageName, BitmapName);

            return(NewWorker);
        }
Ejemplo n.º 3
0
        private AggressiveMoveUnitStats CreateAggressive(int Cost, float Speed, int MaxHealth, int Damage, float Range, float ReloadTime, string imageName, string BitmapName, UnitTypes ThisAggressiveType)
        {
            AggressiveMoveUnitStats NewAggressive = new AggressiveMoveUnitStats();

            NewAggressive.UT         = ThisAggressiveType;
            NewAggressive.cost       = Cost;
            NewAggressive.speed      = Speed;
            NewAggressive.maxHealth  = MaxHealth;
            NewAggressive.spawnType  = typeof(Aggressive);
            NewAggressive.damage     = Damage;
            NewAggressive.range      = Range;
            NewAggressive.reloadTime = ReloadTime;
            NewAggressive.image      = VisibleUnit.AddBitmap(imageName, BitmapName);

            return(NewAggressive);
        }
Ejemplo n.º 4
0
        public void GenerateLevel()
        {
            //Make the wall's image
            Wall.SetImage(VisibleUnit.AddBitmap("wall.png", "wallBitmap"));

            //Make the Resource's's image
            Resource.SetImage(VisibleUnit.AddBitmap("Resource.png", "resourceBitmap"));

            int          NumOTeams = 0;
            StreamReader reader    = new StreamReader(_mapLocation);

            try {
                string currentLine = reader.ReadLine();
                while (currentLine != null)
                {
                    //create border
                    if (currentLine.StartsWith("d"))
                    {
                        string [] dimensions = currentLine.Split(new char [] { 'd', ' ' });
                        int       width      = int.Parse(dimensions [1]);
                        int       height     = int.Parse(dimensions [2]);

                        for (int i = 0; i <= width; i++)
                        {
                            CreateWall(i, 0);
                        }
                        for (int i = 1; i <= height; i++)
                        {
                            CreateWall(0, i);
                        }
                        for (int i = 1; i <= width; i++)
                        {
                            CreateWall(i, height);
                        }
                        for (int i = 1; i <= (height - 1); i++)
                        {
                            CreateWall(width, i);
                        }
                    }
                    else

                    //fill/line
                    if (currentLine.StartsWith("f"))
                    {
                        string [] dimensions = currentLine.Split(new char [] { 'f', ' ' });
                        int       left       = int.Parse(dimensions [1]);
                        int       right      = int.Parse(dimensions [3]);
                        int       top        = int.Parse(dimensions [2]);
                        int       bottom     = int.Parse(dimensions [4]);
                        //across
                        for (int h = top; h <= bottom; h++)
                        {
                            //height
                            for (int w = left; w <= right; w++)
                            {
                                CreateWall(w, h);
                            }
                        }
                    }
                    else

                    //create wall
                    if (currentLine.StartsWith("w"))
                    {
                        string [] coordinates = currentLine.Split(new char [] { 'w', ' ' });
                        CreateWall(float.Parse(coordinates [1]), float.Parse(coordinates [2]));
                    }
                    else

                    //create team base
                    if (currentLine.StartsWith("t"))
                    {
                        string [] coordinates = currentLine.Split(new char [] { 't', ' ' });

                        //home base
                        Building HomeBase = CreateBuilding(ref GameMain.MasterGameStats._buildingHome, float.Parse(coordinates [1]), float.Parse(coordinates [2]));

                        //Archery
                        Building Archery = CreateBuilding(ref GameMain.MasterGameStats._buildingArchery, float.Parse(coordinates [3]), float.Parse(coordinates [4]));

                        //Barraks
                        Building Barraks = CreateBuilding(ref GameMain.MasterGameStats._buildingBarraks, float.Parse(coordinates [5]), float.Parse(coordinates [6]));

                        Map thisMap = this;
                        VirtualIntelligence teamIntelligence = new VirtualIntelligence(ref thisMap, HomeBase, Archery, Barraks, GameMain.MasterGameStats._teams.Pop(), _TeamColors[NumOTeams]);
                        if (NumOTeams < _TeamColors.Length - 1)
                        {
                            NumOTeams++;
                        }
                        else
                        {
                            NumOTeams = 0;
                        }
                        GameMain.BuildingsProcessList.Add(teamIntelligence);
                        GameMain.BuildingsProcessList.Add(HomeBase);
                        GameMain.BuildingsProcessList.Add(Archery);
                        GameMain.BuildingsProcessList.Add(Barraks);
                    }
                    else

                    //Create Resource
                    if (currentLine.StartsWith("r"))
                    {
                        string [] coordinates = currentLine.Split(new char [] { 'r', ' ' });
                        CreateResource(float.Parse(coordinates [1]), float.Parse(coordinates [2]));
                    }
                    currentLine = reader.ReadLine();
                }
            } finally {
                reader.Close();
            }
        }
Ejemplo n.º 5
0
 public void RemoveFromGrid(VisibleUnit VU)
 {
     _grid.Remove(VU.Position);
 }