Example #1
0
    /// <summary>
    /// Trains a Soldier and spawns it in front of the building (using ProductionPipe class).
    /// </summary>
    public void TrainSoldier()
    {
        // Check if the player has enough resources.
        if (productionPipe.EnoughResources(soldier))
        {
            // Remove the resource cost from the player resources.
            player.resources.RemoveResources(soldier.buildCost);

            // Add the soldier to the production pipeline.
            productionPipe.AddUnit(soldier);
        }
    }
Example #2
0
    /// <summary>
    /// Trains a citizen and spawns it in front of the building (using ProductionPipe class).
    /// </summary>
    public void TrainCitizen()
    {
        // Check if the player has enough resources.
        if (productionPipe.EnoughResources(citizen))
        {
            // Remove the resource cost from the player resources.
            player.resources.RemoveResources(citizen.buildCost);

            // Add the citizen to the production pipeline.
            productionPipe.AddUnit(citizen);
        }
    }
Example #3
0
    /// <summary>
    /// Trains an Artillery and spawns it in front of the building (using ProductionPipe class).
    /// </summary>
    public void TrainArtillery()
    {
        // Check if the player has enough resources.
        if (productionPipe.EnoughResources(artillery))
        {
            // Remove the resource cost from the player resources.
            player.resources.RemoveResources(artillery.buildCost);

            // Add the artillery to the production pipeline.
            productionPipe.AddUnit(artillery);
        }
    }