Example #1
0
    private BuildingBuff ConstructBuff(PropsBuffConfigData configData)
    {
        PropsBuffType type = (PropsBuffType)configData.RelatedBuffType;

        switch (type)
        {
        case PropsBuffType.HP:
        {
            BuildingHPBuff hpBuff = new BuildingHPBuff(configData.Effect);
            return(hpBuff);
        }

        case PropsBuffType.Attack:
        {
            BuildingAttackValueBuff attackBuff = new BuildingAttackValueBuff(configData.Effect);
            return(attackBuff);
        }

        case PropsBuffType.AttackSpeed:
        {
            BuildingAttackSpeedBuff attackSpeedBuff = new BuildingAttackSpeedBuff(configData.Effect);
            return(attackSpeedBuff);
        }
        }
        return(null);
    }
Example #2
0
    public void AddPlayerBuff(int propsNo)
    {
        PropsLogicData      propsData     = LogicController.Instance.GetProps(propsNo);
        PropsBuffConfigData newBuffConfig = propsData.FunctionConfigData as PropsBuffConfigData;
        BuffData            buffData      = new BuffData();

        buffData.RelatedPropsType = propsData.PropsType;
        buffData.RemainingCD      = newBuffConfig.LastingSeconds;
        buffData.BuffConfigData   = newBuffConfig;

        foreach (KeyValuePair <BuffData, BuffLogicData> buff in this.m_Buffs)
        {
            if (newBuffConfig.BuffCategory == buff.Key.BuffConfigData.BuffCategory)
            {
                this.RemoveBuff(buff.Key);
                break;
            }
        }
        this.AddBuff(buffData);

        AddPlayerBuffRequestParameter request = new AddPlayerBuffRequestParameter();

        request.PropsNo     = propsNo;
        request.OperateTick = LogicTimer.Instance.GetServerTick();
        CommunicationUtility.Instance.AddPlayerBuff(request);
    }
Example #3
0
 private void AddBuff(BuildingCategory category, PropsBuffConfigData data)
 {
     if (!this.m_CategoryBuffs.ContainsKey(category))
     {
         this.m_CategoryBuffs.Add(category, new List <PropsBuffConfigData>());
     }
     this.m_CategoryBuffs[category].Add(data);
 }
Example #4
0
    public void InitialBuff(List <BattleBuffParameter> buffs)
    {
        foreach (BattleBuffParameter buff in buffs)
        {
            PropsBuffConfigData configData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(buff.RelatedPropsType).
                                             FunctionConfigData as PropsBuffConfigData;
            this.m_Buffs.Add(configData);

            BuildingCategory relatedCategory = (BuildingCategory)configData.RelatedBuildingCategory;

            if (relatedCategory == BuildingCategory.Any)
            {
                this.AddBuff(BuildingCategory.None, configData);
                this.AddBuff(BuildingCategory.Resource, configData);
                this.AddBuff(BuildingCategory.Defense, configData);
            }
            else
            {
                this.AddBuff(relatedCategory, configData);
            }
        }
    }