Пример #1
0
        public void ApplyResearch(ResearchData rd, Overseer os, Architech arch, Wizard wiz, UiMaster master)
        {
            List <Ai_Type> zombies = new List <Ai_Type>()
            {
                Ai_Type.Z_Archer,
                Ai_Type.Z_Horseman,
                Ai_Type.Z_Knight,
                Ai_Type.Z_Priest
            };
            List <Ai_Type> ais = new List <Ai_Type>()
            {
                Ai_Type.Archer,
                Ai_Type.Horseman,
                Ai_Type.Knight,
                Ai_Type.Priest
            };
            List <BuildingTypes> buildings = new List <BuildingTypes>()
            {
                BuildingTypes.EnergyConduit,
                BuildingTypes.Grave,
                BuildingTypes.Wall
            };
            List <SpellType> spells = new List <SpellType>()
            {
                SpellType.DrainEssence,
                SpellType.Ressurect,
                SpellType.RestoreEssence
            };

            switch (rd.Modifiers[0].Key)
            {
            case Researchables.ZDamage:
            case Researchables.ZHealth:
            case Researchables.ZSpeed:
            case Researchables.WCost:
            case Researchables.WHealth:
            case Researchables.WProduct:
            case Researchables.SCost:
            case Researchables.SLength:
            case Researchables.SPower:
                master.Messenger.AddMessage(new Text(Vector2.Zero, rd.Name + " Complete", Color.DodgerBlue));
                break;

            case Researchables.AiDamage:
            case Researchables.AiHealth:
            case Researchables.AiSpeed:
                master.Messenger.AddMessage(new Text(Vector2.Zero, "A holy disturbance can be felt.", Color.PaleVioletRed));
                break;
            }



            foreach (KeyValuePair <Researchables, float> rf in rd.Modifiers)
            {
                switch (rf.Key)
                {
                case Researchables.ZDamage:
                case Researchables.ZHealth:
                case Researchables.ZSpeed:
                    os.ChangeStats(rf.Value, zombies, rf.Key);
                    break;

                case Researchables.WCost:
                case Researchables.WHealth:
                case Researchables.WProduct:
                    arch.ChangeStats(rf.Value, buildings, rf.Key);
                    break;

                case Researchables.AiDamage:
                case Researchables.AiHealth:
                case Researchables.AiSpeed:
                    os.ChangeStats(rf.Value, ais, rf.Key);
                    airesearch.RemoveAt(0);
                    break;

                case Researchables.SCost:
                case Researchables.SLength:
                case Researchables.SPower:
                    wiz.ChangeStats(rf.Value, spells, rf.Key);
                    break;
                }
            }
        }