Beispiel #1
0
        public Structure(StructureType type, Point tilePosition, short team)
            : base(new Vector2(tilePosition.X * Rts.map.TileSize, tilePosition.Y * Rts.map.TileSize), type.Size * Rts.map.TileSize, team)
        {
            ID = Player.Players[team].StructureIDCounter++;
            Player.Players[team].StructureArray[ID] = this;

            this.type = type;
            Texture = type.NormalTexture;
            Hp = MaxHp = type.Hp;
            Armor = type.Armor;
            SightRange = type.SightRange;
            rallyable = type.Rallyable;
            SelectionSortValue = type.SelectionSortValue;
            TargetPriority = type.TargetPriority;
            X = tilePosition.X;
            Y = tilePosition.Y;
            this.size = type.Size;
            BuildTime = type.BuildTime;
            UnderConstruction = false;
            PercentDone = 1f;
            setOccupiedPathNodes();
            setExitPathNodes();

            foreach (Structure structure in Structures)
                structure.HasMoved = true;

            foreach (Structure structure in Structures)
                structure.setExitPathNodes();

            foreach (Roks roks in Roks.AllRoks)
                roks.SetExitPathNodes();

            AddStructure(this);
        }
Beispiel #2
0
        public Structure(StructureType type, Point tilePosition, Unit builder, short team)
            : this(type, tilePosition, team)
        {
            UnderConstruction = true;
            PercentDone = 0f;
            Builder = builder;
            //preciseHp = MaxHp * STARTING_HP_PERCENT;
            Hp = (int)(MaxHp * STARTING_HP_PERCENT);
            constructionHpPerTick = (MaxHp - (MaxHp * STARTING_HP_PERCENT)) / (BuildTime / 1000) / 8;

            //((Rts)Game1.Game.CurrentGameState).CogWheels.Add(new StructureCogWheel(this, (int)(Type.Size * Map.TileSize / 2.5f)));
            //if (team == Player.Me.Team)
            //{
                CogWheel = new StructureCogWheel(this, (int)(type.Size * Rts.map.TileSize / 2.5f));
                ((Rts)Game1.Game.CurrentGameState).CogWheels.Add(CogWheel);
            //}

                foreach (PathNode pathNode in OccupiedPathNodes)
                {
                    foreach (Unit unit in pathNode.UnitsContained)
                    {
                        if (unit != Builder)
                        {
                            unit.PushSimple((float)(rand.NextDouble() * MathHelper.TwoPi), Radius * .5f);
                            //unit.CheckForPush(true);
                            unit.CheckForWallHit();
                        }
                    }
                }
        }
Beispiel #3
0
        static StructureType()
        {
            Barracks = new StructureType();
            Barracks.CommandCard = CommandCard.BarracksCommandCard;
            Barracks.NormalTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanBarracks");
            Barracks.BuildingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanBarracks");
            Barracks.PlacingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanBarracks");
            Barracks.Name = "Nub School";
            Barracks.Size = 4;
            Barracks.Hp = 750;
            Barracks.Armor = 2;
            Barracks.SightRange = 7;
            Barracks.BuildTime = 15000;// 25000;
            Barracks.SelectionSortValue = 1;
            Barracks.TargetPriority = 0;
            Barracks.Rallyable = true;
            Barracks.RoksCost = 25;
            Barracks.CutCorners = true;

            TownHall = new StructureType();
            TownHall.CommandCard = CommandCard.TownHallCommandCard;
            TownHall.NormalTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanTownhall");
            TownHall.BuildingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanTownhall");
            TownHall.PlacingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanTownhall");
            TownHall.Name = "Nub City";
            TownHall.Size = 5;
            TownHall.Hp = 1000;
            TownHall.Armor = 2;
            TownHall.SightRange = 10;
            TownHall.BuildTime = 2500;// 25000;
            TownHall.SelectionSortValue = 0;
            TownHall.TargetPriority = 0;
            TownHall.Rallyable = true;
            TownHall.Supply = 8;
            TownHall.RoksCost = 75;
            TownHall.CutCorners = true;

            Farm = new StructureType();
            Farm.CommandCard = CommandCard.BlankCommandCard;
            Farm.NormalTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanFarm");
            Farm.BuildingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanFarm");
            Farm.PlacingTexture = Game1.Game.Content.Load<Texture2D>("structure textures/HumanFarm");
            Farm.Name = "Nub Farm";
            Farm.Size = 3;
            Farm.Hp = 500;
            Farm.Armor = 1;
            Farm.SightRange = 7;
            Farm.BuildTime = 5000;// 25000;
            Farm.SelectionSortValue = 0;
            Farm.TargetPriority = 0;
            Farm.Rallyable = false;
            Farm.Supply = 6;
            Farm.RoksCost = 15;
            Farm.CutCorners = false;
        }
Beispiel #4
0
 public BuildStructureCommand(Unit unit, StructureType structureType, Point structureLocation, Vector2 moveDestination)
     : base(unit, moveDestination)
 {
     StructureType = structureType;
     StructureLocation = structureLocation;
 }
Beispiel #5
0
 public BuildStructureButtonType(Texture2D texture, Keys hotkey, StructureType structureType)
     : base(texture, hotkey, structureType.BuildTime)
 {
     StructureType = structureType;
 }