コード例 #1
0
 public ResearchData(ResearchData rd)
 {
     this.modifiers    = rd.modifiers;
     this.name         = rd.name;
     this.researchTime = rd.researchTime;
     this.texture      = rd.texture;
 }
コード例 #2
0
ファイル: Research.cs プロジェクト: sargeantPig/AHH
        public Research(ResearchData rd)
        {
            data            = new ResearchData(rd);
            state           = ResearchState.Waiting;
            currentProgress = 0;
            Dictionary <Text, Text> temp = new Dictionary <Text, Text>();

            temp.Add(new Text(Vector2.Zero, "", Color.White), new Text(Vector2.Zero, data.Name, Color.White));

            foreach (var a in rd.Modifiers)
            {
                switch (a.Key)
                {
                case Researchables.ZHealth:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Zombie health" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.ZDamage:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Zombie damage" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.ZSpeed:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Zombie speed" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.WCost:
                    temp.Add(new Text(Vector2.Zero, "Decrease ", Color.White), new Text(Vector2.Zero, "Building cost" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.WHealth:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Building health" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.WProduct:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Energy production" + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.SCost:
                    temp.Add(new Text(Vector2.Zero, "Decrease ", Color.White), new Text(Vector2.Zero, "Spell cost " + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.SLength:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Spell length " + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;

                case Researchables.SPower:
                    temp.Add(new Text(Vector2.Zero, "Increase ", Color.White), new Text(Vector2.Zero, "Spell damage " + " by " + (a.Value * 100).ToString() + "%", Color.Green));
                    break;
                }
            }


            Info = new InfoPanel(temp, rd.Texture, Vector2.Zero);
        }
コード例 #3
0
ファイル: Researcher.cs プロジェクト: sargeantPig/AHH
        public void Update(GameTime gt, Overseer os, Architech arch, UiMaster master, Player player, Wizard wiz, Random rnd)
        {
            int i = 0;

            foreach (ButtonFunction bf in functions)
            {
                ResearchUpdate(gt, os, arch, wiz, master, player, i, bf);
                NextResearch(0, master, bf);
                i++;
            }

            if (master.NextAction != ButtonFunction.Nan)
            {
                switch (master.NextAction)
                {
                case ButtonFunction.R1:
                    master.Pop_Action();
                    if (CheckResearchActivity(ButtonFunction.R1, stager[ButtonFunction.R1].Item3))
                    {
                        ChangeState(ButtonFunction.R1);
                    }
                    break;

                case ButtonFunction.R2:
                    master.Pop_Action();
                    if (CheckResearchActivity(ButtonFunction.R2, stager[ButtonFunction.R2].Item3))
                    {
                        ChangeState(ButtonFunction.R2);
                    }
                    break;

                case ButtonFunction.R3:
                    master.Pop_Action();
                    if (CheckResearchActivity(ButtonFunction.R3, stager[ButtonFunction.R3].Item3))
                    {
                        ChangeState(ButtonFunction.R3);
                    }
                    break;
                }
            }

            if (master.Highlight != ButtonFunction.Nan)
            {
                switch (master.Highlight)
                {
                case ButtonFunction.R1:
                    master.RecieveInfo(new KeyValuePair <Guid, InfoPanel>(research[master.Highlight].ToList()[stager[ButtonFunction.R1].Item3].Value.ID,
                                                                          research[master.Highlight].ToList()[stager[ButtonFunction.R1].Item3].Value.Info));
                    RemoveInfo(master, new ButtonFunction[] { ButtonFunction.R2, ButtonFunction.R3 });
                    break;

                case ButtonFunction.R2:
                    master.RecieveInfo(new KeyValuePair <Guid, InfoPanel>(research[master.Highlight].ToList()[stager[ButtonFunction.R2].Item3].Value.ID,
                                                                          research[master.Highlight].ToList()[stager[ButtonFunction.R2].Item3].Value.Info));
                    RemoveInfo(master, new ButtonFunction[] { ButtonFunction.R1, ButtonFunction.R3 });
                    break;

                case ButtonFunction.R3:
                    master.RecieveInfo(new KeyValuePair <Guid, InfoPanel>(research[master.Highlight].ToList()[stager[ButtonFunction.R3].Item3].Value.ID,
                                                                          research[master.Highlight].ToList()[stager[ButtonFunction.R3].Item3].Value.Info));
                    RemoveInfo(master, new ButtonFunction[] { ButtonFunction.R2, ButtonFunction.R1 });
                    break;
                }
            }

            if (player.Mode != Player_Modes.Research)
            {
                RemoveInfo(master, new ButtonFunction[] { ButtonFunction.R1, ButtonFunction.R2, ButtonFunction.R3 });
            }

            elasped += gt.ElapsedGameTime.Milliseconds;

            if (elasped >= aiResearchTimer && airesearch.Count > 0)
            {
                var r = new ResearchData();
                r.Modifiers = new List <KeyValuePair <Researchables, float> >();
                float percent = (float)rnd.NextDouble();
                if (percent == 0)
                {
                    percent = 0.1f / 10f;
                }
                else
                {
                    percent = percent / 10f;
                }
                r.Modifiers.Add(new KeyValuePair <Researchables, float>(airesearch.First(), percent));
                ApplyResearch(r, os, arch, wiz, master);
                elasped = 0;
            }
        }
コード例 #4
0
ファイル: Researcher.cs プロジェクト: sargeantPig/AHH
        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;
                }
            }
        }