Exemple #1
0
        public void Destroyed()
        {
            if (m_currentBuildingThing != null)
            {
                //Removes supplyValue from object being built as it was artificially added !  Same with UnitPower
                m_player.RemoveSupply(GetSupplyValue());
                m_player.RemoveUnitPower(m_currentBuildingThing.m_type);
                //Sets currentlybuilding to null
                m_currentBuildingThing = null;
            }
            //remove the building from builders list
            m_player.RemoveThingBuilder(m_builder);
            if (m_sacrifices.Count > 0)
            {
                //Since This buildbehavior removed the workers without removing supply & unitPower yet removed em from the list,
                //Just Adding them back would cause double supplies & unitpower Growth which is bad!
                m_player.RemoveSupply(m_sacrifices.Count * m_sacrifices[0].m_supplyValue);
                m_player.RemoveUnitPower(m_sacrifices[0].m_type, m_sacrifices.Count);

                //Doesn't remove the blocked tiles on map, cause that's the m_builders.RemoveMe() functions job
                MathGameHelper.RestoreXPercentUnits(m_sacrifices, m_player, 0.25f);
            }

            //If the building dies before the new possible sacrifices becomes fullfledged ones!
            foreach (Thing asp in m_aspiringSacrifices)
            {
                //Make it stop moving!
                asp.ChangeDestination(asp.m_currentposition);
            }
        }
Exemple #2
0
        /// <summary>
        /// User canceled the build, meaning user will be refunded some of the resources used to build the structure / something else.
        /// </summary>
        public void CancelBuild(Player a_player, Map a_map)
        {
            MathGameHelper.RestoreXPercentUnits(m_builders, a_player, 0.25f);

            Rectangle f_buildArea = MathGameHelper.GetAreaRectangle(ref m_object.m_currentposition, ref m_object.m_size);

            //Also removes the blocked tiles from the building
            a_map.RemoveBuildingOnMap(ref f_buildArea);

            m_cancelled = true;
        }