public static void GainSkill(SkillName name)
        {
            var skill = LearnedSkills.FirstOrDefault(x => x.Name == name);

            //新技能
            if (skill == null)
            {
                skill = ActivedSkills.FirstOrDefault(x => x.Name == name).Clone();

                SkillUpdater.NewSkill(skill);
                LearnedSkills.Add(skill);
                BattleUpdater.UpdateMessage("学会" + ((skill.RareDegree == SkillRareDegree.Rare) ? "稀有" : "") + "技能:" + skill.DisplayName);
            }
            else
            {
                if (skill.Level != 3)
                {
                    skill.LevelUp();
                    SkillUpdater.UpgradeSkill(skill);
                    BattleUpdater.UpdateMessage("技能 " + skill.DisplayName + " 提升至" + skill.Level.ToString() + "级");
                }
                else
                {
                    Hero.GetExp(15);
                    BattleUpdater.UpdateMessage("技能已提升至满级,转化为15点经验值");
                }
            }
        }
Beispiel #2
0
 void InitButtonEvents()
 {
     #region 结束回合
     Button btnEndTurn = GameObject.Find("SubCanvasBattling/BtnEndTurn").GetComponent <Button>();
     btnEndTurn.onClick.AddListener(delegate()
     {
         BattleUpdater.UpdateMessage("战斗胜利!\n获得15经验值,15金币");
         GameInfo.Money += 15;
         Hero.GetExp(15);
         Hero.RecoverHealth(-10);
         GameInfo.NewStage();
     });
     #endregion
 }
 public static void GenerateHotelEvent(BaseEvent e)
 {
     e.Title       = "荒原酒馆";
     e.Description = "花费金币休息有可能得到意外的惊喜!";
     e.Choose1Name = "驻足";
     e.Choose2Name = "大吃一顿";
     e.Choose3Name = "住宿休息";
     e.Choose1Desc = "恢复最大生命值和魔法值的20%";
     e.Choose2Desc = "花费50金币\n恢复最大生命值和魔法值的50%";
     e.Choose3Desc = "花费100金币\n恢复所有生命值和魔法值";
     e.Sprite      = SpriteHelper.GetEventSprite(e.Type);
     e.Choose1     = () =>
     {
         Hero.Health = Math.Min(Hero.MaxHealth, Hero.Health + Hero.MaxHealth * 0.2f);
         Hero.Mana   = Math.Min(Hero.MaxMana, Hero.Mana + Hero.MaxMana * 0.2f);
         PropertyPanelUpdater.Update();
         GameInfo.NewStage();
     };
     e.Choose2 = () =>
     {
         if (GameInfo.Money < 50)
         {
             BattleUpdater.UpdateMessage("别逗我,你太穷了");
             return;
         }
         GameInfo.Money -= 50;
         Hero.RecoverHealth(Hero.MaxHealth * 0.5f);
         Hero.RecoverMana(Hero.MaxMana * 0.5f);
         BattleUpdater.UpdateStageInfo();
         GameInfo.NewStage();
     };
     e.Choose3 = () =>
     {
         if (GameInfo.Money < 100)
         {
             BattleUpdater.UpdateMessage("别逗我,你太穷了");
             return;
         }
         GameInfo.Money -= 100;
         Hero.RecoverHealth(Hero.MaxHealth);
         Hero.RecoverMana(Hero.MaxMana);
         BattleUpdater.UpdateStageInfo();
         GameInfo.NewStage();
     };
 }
        /// <summary>
        /// 开始一场新的对局
        /// </summary>
        public static void NewGame()
        {
            CurrentScene       = SceneType.BattleMain;
            EndType            = GameEndType.None;
            ActivedProps       = new List <BaseProp>();
            GainedProps        = new List <PropName>();
            ActivedSkills      = new List <BaseSkill>();
            LearnedSkills      = new List <BaseSkill>();
            EventList          = new List <BaseEvent>();
            OccurredEvents     = new List <BaseEvent>();
            CurrentStageEvents = new List <BaseEvent>();

            HeroRoleList = new List <BaseHeroRole>();
            Day          = 0;
            Money        = 1200;

            //初始化照相机信息
            CameraSetter.Init();
            //初始化宝物信息
            PropIniter.Init();
            //初始化技能信息
            SkillIniter.Init(Role);
            //初始化事件信息
            EventIniter.Init();
            //初始化怪物列表
            MonsterIniter.Init();
            //初始化职业信息
            HeroRoleIniter.Init();
            //初始化英雄属性
            Hero.New(Role);

            Hero.Health = 40;
            Hero.Mana   = 1;
            //更新英雄属性面板
            PropertyPanelUpdater.Update();
            //更新关卡信息面板
            BattleUpdater.UpdateStageInfo();

            BattleUpdater.UpdateMessage("欢迎来到荒原之城!");

            BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.ChooseEvent);
            BattleCanvasSetter.SwitchBattleScene();
            NewStage();
        }