Пример #1
0
        public void PerformAction(Game game)
        {
            MoodSwing moodSwing = (MoodSwing)game;
            MSDistrictScreen screen = moodSwing.CurrentScreen as MSDistrictScreen;
            if (screen.ResourceManager.Funds >= MSFundraiserStats.GetInstance().GetFundsCost())
            {
                if (screen.ResourceManager.IdleVolunteers >= MSFundraiserStats.GetInstance().GetVolunteerCost())
                {
                    screen.ResourceManager.Funds -= MSFundraiserStats.GetInstance().GetFundsCost();
                    screen.ResourceManager.IdleVolunteers -= MSFundraiserStats.GetInstance().GetVolunteerCost();
                    MS3DTile futureSelf = new MSFundraiser("MModels/BuildingBig",
                        "MTextures/BuildingFunds",
                        "Mood",
                        toBuy.Position,
                        toBuy.Rotation,
                        toBuy.Row,
                        toBuy.Column,
                        screen.ResourceManager);
                    futureSelf.LightSource = screen.Map.LightSource;
                    toBuy.StartBuildProcess(MSFundraiserStats.GetInstance().GetVolunteerCost(), futureSelf);

                    MSUnitHandler.GetInstance().SendWorkers(screen.Map, toBuy,
                        MSFundraiserStats.GetInstance().GetVolunteerCost());
                    screen.RemoveComponent(screen.CircularPicker);
                }
                else
                {
                    MoodSwing.GetInstance().Notifier.InvokeNotification("You need more volunteers.");
                }
            }
            else
            {
                MoodSwing.GetInstance().Notifier.InvokeNotification("You need more funds.");
            }
        }
Пример #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;
        }