示例#1
0
        private void Action()
        {
            GameUnit.GameUnit unit           = (GameUnit.GameUnit) this.GetSelectingUnits()[0];
            Vector3           unitCoordinate = BattleMap.BattleMap.Instance().GetUnitCoordinate(unit);
            AbilityFormat     ability        = AbilityDatabase.GetInstance().GetAbilityFormat("Arrowrain");

            Gameplay.Instance().gamePlayInput.HandleSkillConfim(unitCoordinate, (int)ability.AbilityVariable.Range);//显示技能可释放范围(攻击范围)
            //GamePlay.Gameplay.Instance().gamePlayInput.isSkill = true;//可以发动技能
        }
示例#2
0
 private void Start()
 {
     arrowrRain = AbilityDatabase.GetInstance().GetAbilityFormat("Arrowrain");
     range      = (int)arrowrRain.AbilityVariable.Range;
     damage     = (int)arrowrRain.AbilityVariable.Damage;
     //创建Trigger实例,传入技能的发动者
     trigger = new TArrowrain(this.GetCardReceiver(this));
     //注册Trigger进消息中心
     MsgDispatcher.RegisterMsg(trigger, "Arrowrains");
 }
示例#3
0
        /// <summary>
        /// 从异能数据库加载对应异能的参数
        /// </summary>
        /// <param name="AbilityID">要加载的异能的ID</param>
        protected void InitialAbility(string AbilityID)
        {
            AbilityFormat abilityFormat = AbilityDatabase.GetInstance().GetAbilityFormat(AbilityID);

            //用序列化拷贝AbilityTargetList;
            Stream stream = GameUtility.Serializer.InstanceDataToMemory(abilityFormat.AbilityTargetList);

            stream.Position        = 0;
            this.AbilityTargetList = (List <AbilityTarget>)GameUtility.Serializer.MemoryToInstanceData(stream);
            //用序列化拷贝AbilityVariable
            stream               = GameUtility.Serializer.InstanceDataToMemory(abilityFormat.AbilityVariable);
            stream.Position      = 0;
            this.AbilityVariable = (AbilityVariable)GameUtility.Serializer.MemoryToInstanceData(stream);
            //Debug.Log("Success copy AbilityVariable");
            //拷贝变量
            this.AbilityID   = abilityFormat.AbilityID;
            this.Group       = abilityFormat.Group;
            this.AbilityName = abilityFormat.AbilityName;
            this.Description = abilityFormat.Description;
            this.TriggerID   = abilityFormat.TriggerID;
        }
        /// <summary>
        /// 初始化异能数据库
        /// </summary>
        private void InitAbilityDatabase()
        {
            _abilityData = new Dictionary <string, AbilityFormat>();

            JsonData abilitiesJsonData =
                JsonMapper.ToObject(File.ReadAllText(Application.dataPath + JsonFilePath));

            for (int i = 0; i < abilitiesJsonData.Count; i++)
            {
                //如果数据库里还没有这个异能
                if (!_abilityData.ContainsKey(abilitiesJsonData[i]["AbilityID"].ToString()))
                {
                    JsonData      tmp        = abilitiesJsonData[i];
                    AbilityFormat newAbility = new AbilityFormat(tmp["AbilityID"].ToString());

                    //Debug.Log(tmp["AbilityID"]);

                    if ((int)tmp["TargetCount"] > 0)
                    {
                        newAbility.AbilityTargetList.Add(new AbilityTarget(tmp["TargetType"].ToString(), ((int)tmp["IsSpeller"] > 0), ((int)tmp["IsTarget"] > 0)));
                    }
                    FullAbilityVariable(newAbility.AbilityVariable, tmp);
                    newAbility.Group       = (int)tmp["Group"];
                    newAbility.AbilityName = tmp["AbilityName"].ToString();
                    newAbility.Description = tmp["Description"].ToString();
                    newAbility.TriggerID   = tmp["TriggerID"].ToString();

                    //数据库中加入这个异能
                    _abilityData.Add(tmp["AbilityID"].ToString(), newAbility);
                }
                else
                {
                    //如果已经有这个异能,直接加入对象即可
                    JsonData tmp = abilitiesJsonData[i];

                    _abilityData[tmp["AbilityID"].ToString()].AbilityTargetList.Add(new AbilityTarget(tmp["TargetType"].ToString(), ((int)tmp["IsSpeller"] > 0), ((int)tmp["IsTarget"] > 0)));
                }
            }
        }
示例#5
0
 private void Awake()
 {
     //导入Arrowrain异能的参数
     arrowrRain = AbilityDatabase.GetInstance().GetAbilityFormat("Arrowrain");
     InitialAbility("Arrowrain");
 }