public void PerformAction(Game game)
        {
            MoodSwing moodSwing = (MoodSwing)game;
            MSDistrictScreen screen = moodSwing.CurrentScreen as MSDistrictScreen;
            if (!MSUnitHandler.GetInstance().IsLeaderBusy &&
                screen.ResourceManager.Funds >= MSVolunteerCenterStats.GetInstance().GetFundsCost())
            {
                screen.ResourceManager.Funds -= MSVolunteerCenterStats.GetInstance().GetFundsCost();
                //screen.ResourceManager.VolunteerCapacity += MSResourceManager.VOLUNTEER_CENTER_GAIN;
                MS3DTile futureSelf = new MSVolunteerCenter("MModels/BuildingBig",
                    "MTextures/BuildingVolunteer",
                    "Mood",
                    toBuy.Position,
                    toBuy.Rotation,
                    toBuy.Row,
                    toBuy.Column);
                futureSelf.LightSource = screen.Map.LightSource;
                toBuy.StartBuildProcess(1, futureSelf);

                MSUnitHandler.GetInstance().SendWorkers(screen.Map, toBuy, 1);
                MSUnitHandler.GetInstance().IsLeaderBusy = true;
                screen.RemoveComponent(screen.CircularPicker);
            }
            else if (MSUnitHandler.GetInstance().IsLeaderBusy)
            {
                MoodSwing.GetInstance().Notifier.InvokeNotification("You may only build one Volunteer Center at a time.");
            }
            else
            {
                MoodSwing.GetInstance().Notifier.InvokeNotification("You need more funds.");
            }
        }
Beispiel #2
0
        public static MS3DTile loadMSTile(StreamReader sr)
        {
            MS3DTile toReturn = null;
            String id = sr.ReadLine();
            String modelName = sr.ReadLine();
            String textureName = sr.ReadLine();
            String effectName = sr.ReadLine();
            string[] position = sr.ReadLine().Split(' ');
            Vector3 pos = Vector3.Zero;
            pos.X = float.Parse(position[0]);
            pos.Y = float.Parse(position[1]);
            pos.Z = float.Parse(position[2]);
            float rotation = float.Parse(sr.ReadLine());
            int row = Int32.Parse(sr.ReadLine());
            int column = Int32.Parse(sr.ReadLine());

            if (id.Equals("MSRoad"))
            {
                toReturn = new MSRoad(modelName, textureName, effectName, pos, rotation, row, column);
            }
            else if (id.Equals("MSVolunteerCenter"))
            {
                toReturn = new MSVolunteerCenter(modelName, textureName, effectName, pos, rotation, row, column);
            }
            else if (id.Equals("MSUnchangeableBuilding"))
            {
                toReturn = new MSUnchangeableBuilding(modelName, textureName, effectName, pos, rotation, row, column);
            }
            else if (id.Equals("MSFundraiser"))
            {
                toReturn = new MSFundraiser(modelName, textureName, effectName, pos, rotation, row, column, MSResourceManager.GetInstance());
                (toReturn as MSFundraiser).load(sr);
            }
            else if (id.Equals("MSDistrictHall"))
            {
                MSDistrictHall.instantiate(modelName, textureName, effectName, pos, rotation, row, column);
                toReturn = MSDistrictHall.getInstance();
            }
            else if (id.Equals("MSAbandonedBuilding"))
            {
                toReturn = new MSAbandonedBuilding(modelName, textureName, effectName, pos, rotation, row, column);
                (toReturn as MSAbandonedBuilding).load(sr);
            }
            else if (id.Equals("MSTower"))
            {

                toReturn = new MSTower(modelName, textureName, effectName, pos, rotation, row, column, MSMap.tallheight, null );
                (toReturn as MSTower).load(sr);
            }

            return toReturn;
        }