IEnumerator stopSoldierTimer(EffectParameter effectParameter, AttachPropData attachPropData)
        {
            yield return(new WaitForSeconds(effectParameter.value));

            foreach (UnitCtl unit in effectParameter.unitCtlList)
            {
                if (unit == null)
                {
                    continue;
                }
                if (unit.unitData == null)
                {
                    continue;
                }
                if (unit.unitData.unitType == UnitType.Build)
                {
                    continue;
                }
                else
                {
                    unit.unitData.RevokeProps(attachPropData);
                }
            }

            Debug.Log(string.Format("<color=yellow> stopSoldierTimer </color>"));
        }
示例#2
0
        override public void ParseCsv(string[] csv)
        {
            //			编号	名称	炮弹Avatar	攻击范围	攻击速度	攻击伤害
            //			id	name	turretAvatar	attackRadius	attackSpeed	attackDamage
            int i = 0;

            // 箭塔编号
            id = csv.GetInt32(i++);
            // 名称
            name = csv.GetString(i++);
            // 箭塔素材
            avatarId = csv.GetInt32(i++);
            // 攻击范围
            attackRadius = csv.GetSingle(i++);
            // 攻击速度
            attackSpeed = csv.GetSingle(i++);
            // 攻击伤害
            attackDamage = csv.GetSingle(i++);
            // 属性列表
            props = new Prop[] { Prop.CreateInstance(PropId.AttackRadiusAdd, attackRadius),
                                 Prop.CreateInstance(PropId.AttackSpeedAdd, attackSpeed),
                                 Prop.CreateInstance(PropId.AttackDamageAdd, attackDamage) };

            attachPropData = new AttachPropData(props);

            War.model.AddBuildTurretConfig(this);
        }
示例#3
0
        //灼烧标记
        public void buildingBurnTag(EffectParameter effectInfo)
        {
            effectParameterList.Add(effectInfo);
            UnitCtl unit = gameObject.GetComponent <UnitCtl>();

            Prop[]         props          = new Prop[] { Prop.CreateInstance(PropId.StateBurn, 1) };
            AttachPropData attachPropData = new AttachPropData(props);

            if (effectInfo.effect.buffAnimPath != "temp")
            {
                GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.buffAnimPath);
                GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                effectAnim.transform.position = unit.transform.position;
                DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                if (destoryTimer != null)
                {
                    destoryTimer.DelayTime = effectInfo.effect.time;
                }
                effectInfo.effectAnim = effectAnim;
                Debug.Log("=======destoryTimer.DelayTime: " + effectInfo.effect.time);
            }
            unit.unitData.AppProps(attachPropData, true);

            if (effectInfo.effect.time > 0)
            {
                effectInfo.waitTime = effectInfo.effect.time;
                StartCoroutine(burnTagTimer(attachPropData, effectInfo));
            }
        }
示例#4
0
        /** 移除 */
        public override void Revoke(int uid, UnitData unitData, bool calculate = false)
        {
            LegionData     legionData     = unitData.legionData;
            AttachPropData attachPropData = GetAttachPropData(uid);

            switch (unitType)
            {
            case UnitType.Player:
                legionData.legionPropContainer.Remove(attachPropData);
                legionData.buildPropContainer.Remove(attachPropData);
                legionData.soliderPropContainer.Remove(attachPropData);
                break;

            case UnitType.Build:
                legionData.buildPropContainer.Remove(attachPropData);
                break;

            case UnitType.Solider:
                legionData.soliderPropContainer.Remove(attachPropData);
                break;

            case UnitType.Hero:
                legionData.heroPropContainer.Remove(attachPropData);
                break;
            }
        }
示例#5
0
        /** 附加属性--等级 */
        public AttachPropData GetCasernLevelProps(int level)
        {
            AttachPropData attachPropData = null;

            if (casernLevelAttachPropData.TryGetValue(level, out attachPropData))
            {
                return(attachPropData);
            }
            return(null);
        }
        IEnumerator heroSilenceSkill2Timer(EffectParameter effectParameter, AttachPropData attachPropData)
        {
            yield return(new WaitForSeconds(effectParameter.effect.time));

            foreach (UnitCtl unit in effectParameter.unitCtlList)//获取城市
            {
                //todo 沉默
                unit.unitData.RevokeProps(attachPropData, true);
            }
            Debug.Log(string.Format("<color=yellow> heroSilenceSkill2Timer </color>"));
        }
示例#7
0
        public AttachPropData GetAttachPropData(int uid)
        {
            if (attachPropDataDict.ContainsKey(uid))
            {
                return(attachPropDataDict[uid]);
            }

            AttachPropData attachPropData = new AttachPropData(uid, props);

            attachPropDataDict.Add(uid, attachPropData);
            return(attachPropData);
        }
示例#8
0
        IEnumerator changeAttributeTimer(EffectParameter effectParameter, AttachPropData attachPropData)
        {
            yield return(new WaitForSeconds(effectParameter.effect.time));

            UnitCtl unit = gameObject.GetComponent <UnitCtl>();

            unit.unitData.soliderPropContainer.Remove(attachPropData);

            effectParameter.waitTime = 0;
            CleanList();

            Debug.Log(string.Format("<color=yellow> addAttributeTimer done attachPropData :{0}</color>", effectParameter.effect.changePropertyId));
        }
示例#9
0
        IEnumerator effectBuildCantSendTimer(EffectParameter effectParameter, AttachPropData attachPropData, UnitCtl unit)
        {
            yield return(new WaitForSeconds(effectParameter.value));

            if (effectParameter.effect.type == (int)eSKillWarEffectType.eEffectReduceSpeedTo)//修改材质
            {
                unit.unitAgent.BackMaterial(WarMaterialsType.stateFreeze);
            }
            unit.unitData.RevokeProps(attachPropData, true);

            effectParameter.waitTime = 0;
            CleanList();
            Debug.Log(string.Format("<color=yellow> effectBuildCantSendTimer </color>"));
        }
示例#10
0
        public void Init()
        {
            soliderInitProp [PropId.InitMoveSpeed] *= War.sceneData.weight.moveSpeed;
            soliderInitProp [PropId.MoveSpeedAdd]  *= War.sceneData.weight.moveSpeed;
            soliderInitProp [PropId.MoveSpeedPer]  *= War.sceneData.weight.moveSpeed;


            AttachPropData attachPropData;

            // 势力
            attachPropData = new AttachPropData(legionInitProp.FilterZero());
            legionInitPropContainer.Add(attachPropData);


            attachPropData = new AttachPropData(soliderInitProp.FilterZero());
            soliderInitPropContainer.Add(attachPropData);

            // 建筑
            buildInitAttachPropData = new AttachPropData(buildInitProp.FilterZero());

            foreach (KeyValuePair <int, Prop[]> kvp in casernLevelProp)
            {
                attachPropData = new AttachPropData(kvp.Value);
                casernLevelAttachPropData.Add(kvp.Key, attachPropData);
            }

            foreach (KeyValuePair <int, float[]> kvp in hero2BuildProp)
            {
                attachPropData = new AttachPropData(kvp.Value.FilterZero());
                hero2BuildAttachPropData.Add(kvp.Key, attachPropData);
            }

            // 英雄
            foreach (KeyValuePair <int, float[]> kvp in heroInitProp)
            {
                attachPropData = new AttachPropData(kvp.Value.FilterZero());
                heroInitAttachPropData.Add(kvp.Key, attachPropData);
//				Debug.Log("英雄heroInitAttachPropData kvp.Key=" + kvp.Key);
            }



            soliderInitData = soliderData.Clone();
            soliderPropContainer.UnitApp(soliderInitData);
            soliderInitPropContainer.UnitApp(soliderInitData, true);

            levelData.Init();
            levelData.Level = 1;
        }
示例#11
0
        /** 属性实体--移除附加 */
        public static void RevokeProps(this IPropUnit src, AttachPropData attachPropData, bool calculate = false)
        {
            if (attachPropData == null)
            {
                return;
            }

            if (src.AttachProps.ContainsKey(attachPropData.uid))
            {
                attachPropData.Revoke(src);
            }

            if (calculate)
            {
                src.Props.Calculate();
            }
        }
示例#12
0
        public override void ParseCsv(string[] csv)
        {
//			编号	名称	属性2-产兵速度
//			id	name	ProduceSpeedAdd
            int i = 0;

            // 编号
            id = csv.GetInt32(i++);
            // 名称
            name = csv.GetString(i++);
            // 属性
            props = PropConfigUtils.ParsePropFields(csv, i);


            attachPropData = new AttachPropData(props);

            War.model.AddBuildProduceConfig(this);
        }
示例#13
0
        public override void ParseCsv(string[] csv)
        {
//			编号	名称	属性1-兵力上限	属性3--防御	属性4--伤害
//			id	name	MaxHpAdd	DefendAdd	AttackDamageAdd

            int i = 0;

            // 编号
            id = csv.GetInt32(i++);
            // 名称
            name = csv.GetString(i++);
            // 属性
            props = PropConfigUtils.ParsePropFields(csv, i);


            attachPropData = new AttachPropData(props);

            War.model.AddBuildBasepropConfig(this);
        }
示例#14
0
        /** 属性实体--添加附加 */
        public static void AppProps(this IPropUnit src, AttachPropData attachPropData, bool calculate = false)
        {
            if (attachPropData == null)
            {
                return;
            }

            if (src.AttachProps.ContainsKey(attachPropData.uid))
            {
                src.RevokeProps(attachPropData.uid);
            }
            //Debug.Log(string.Format("<color=0x33DD55>  attachPropData={0}, calculate={1}</color>", attachPropData, calculate));
            attachPropData.App(src);


            if (calculate)
            {
                src.Props.Calculate();
            }
        }
示例#15
0
        IEnumerator burnTagTimer(AttachPropData attachPropData, EffectParameter effectInfo)
        {
            int timerCount = 0;

            while (true)
            {
                yield return(new WaitForSeconds(1.0f));

                if (timerCount >= effectInfo.waitTime)
                {
                    UnitCtl unit = gameObject.GetComponent <UnitCtl>();
                    unit.unitData.RevokeProps(attachPropData);
                    break;
                }
                timerCount++;
            }
            effectInfo.waitTime = 0;
            CleanList();
            Debug.Log(string.Format("<color=yellow> burnTagTimer </color>"));
        }
示例#16
0
        public LegionLevelData()
        {
            atkProp          = Prop.CreateInstance(PropId.AtkAdd, 0);
            defProp          = Prop.CreateInstance(PropId.DefAdd, 0);
            produceSpeedProp = Prop.CreateInstance(PropId.ProduceSpeedAdd, 0);
            moveSpeedProp    = Prop.CreateInstance(PropId.MoveSpeedAdd, 0);


            //-------------------
            soliderUnitAttachPropData       = new AttachPropData();
            soliderUnitAttachPropData.props = new Prop[] { atkProp, moveSpeedProp };

            buildUnitAttachPropData       = new AttachPropData();
            buildUnitAttachPropData.props = new Prop[] { produceSpeedProp, defProp };
            //------------------
            soliderAttachPropData       = new AttachPropData();
            soliderAttachPropData.props = new Prop[] {};

            buildAttachPropData       = new AttachPropData();
            buildAttachPropData.props = new Prop[] {};
        }
示例#17
0
        IEnumerator effectBuildCantSendSoldierEnd(EffectParameter effectParameter)
        {
            yield return(new WaitForSeconds(effectParameter.waitTime));

            Prop[]         props          = new Prop[] { Prop.CreateInstance(PropId.StateFreezedSendArm, 1) };
            AttachPropData attachPropData = new AttachPropData(props);

            Debug.Log("=======" + effectParameter.effect.buffAnimPath);
            effectParameter.waitTime = effectParameter.effect.time;
            UnitCtl unit = gameObject.GetComponent <UnitCtl>();

            if (effectParameter.effect.buffAnimPath != "temp")
            {
                GameObject effectPrefab = WarRes.GetPrefab(effectParameter.effect.buffAnimPath);
                GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                //effectAnim.transform.position = unit.transform.position;
                effectAnim.transform.SetParent(unit.transform, false);
                DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                if (destoryTimer != null)
                {
                    destoryTimer.DelayTime = effectParameter.value;
                }
                effectParameter.effectAnim = effectAnim;
                updateBuffPos();
            }
            //todo 设置不能出兵
            if (effectParameter.effect.type == (int)eSKillWarEffectType.eEffectReduceSpeedTo)//修改材质
            {
                unit.unitAgent.SetMaterial(WarMaterialsType.stateFreeze);
            }
            unit.unitData.AppProps(attachPropData, true);
            if (effectParameter.effect.time > 0)
            {
                StartCoroutine(effectBuildCantSendTimer(effectParameter, attachPropData, unit));
            }

            Debug.Log(string.Format("<color=yellow> effectBuildCantSend to {0}  </color>", unit.unitData.id));
        }
示例#18
0
        public void buildChangeAttri(EffectParameter effectParameter)
        {
            effectParameterList.Add(effectParameter);
            float value = effectParameter.value;

            if (effectParameter.effect.type == (int)eSKillWarEffectType.eEffectReduceAttri)
            {
                value = 0 - value;
            }
            UnitCtl unit = gameObject.GetComponent <UnitCtl>();

            effectParameter.waitTime = effectParameter.effect.time;
            Prop[]         props          = new Prop[] { Prop.CreateInstance(effectParameter.effect.changePropertyId, value) };
            AttachPropData attachPropData = new AttachPropData(props);

            //Debug.Log("=================" + effectParameter.unitCtlList.Count + "prop: " + effectParameter.effect.changePropertyId + "value: " + vaue);
            Debug.Log("===============buffAnimPath: " + effectParameter.effect.buffAnimPath);
            unit.unitData.soliderPropContainer.Add(attachPropData);
            if (effectParameter.effect.buffAnimPath != "temp")
            {
                GameObject effectPrefabSelf = WarRes.GetPrefab(effectParameter.effect.buffAnimPath);
                GameObject effectAnim       = GameObject.Instantiate <GameObject>(effectPrefabSelf);
                //effectAnim.transform.position = unit.transform.position;
                effectAnim.transform.SetParent(unit.transform, false);
                effectParameter.effectAnim = effectAnim;
                DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                if (destoryTimer != null)
                {
                    destoryTimer.DelayTime = effectParameter.effect.time;
                }
                updateBuffPos();
            }

            if (effectParameter.effect.time > 0)
            {
                StartCoroutine(changeAttributeTimer(effectParameter, attachPropData));
            }
        }
示例#19
0
        public void InitAttachPropData()
        {
            AttachPropData attachPropData;

            foreach (KeyValuePair <int, float[]> kvp in buildFirstProp)
            {
                attachPropData = new AttachPropData(kvp.Value.FilterZero());
                buildFirstAttachPropData.Add(kvp.Key, attachPropData);
            }


            foreach (KeyValuePair <int, float[]> kvp in buildInitProp)
            {
                attachPropData = new AttachPropData(kvp.Value.FilterZero());
                buildInitAttachPropData.Add(kvp.Key, attachPropData);
            }

            foreach (KeyValuePair <int, BuildSpotConfig> kvp in buildSpotConfigDict)
            {
                attachPropData = new AttachPropData(kvp.Value.props);
                buildSpotAttachPropData.Add(kvp.Key, attachPropData);
            }
        }
        public int heroSilence(SkillParameter skillParameter, EffectParameter effectParameter)
        {
            Debug.Log("=========" + effectParameter.effect.animPathStart + "++++++" + effectParameter.effect.animPathEnd);

            Prop[]         props          = new Prop[] { Prop.CreateInstance(PropId.StateSilence, 1) };
            AttachPropData attachPropData = new AttachPropData(props);

            foreach (UnitCtl unit in effectParameter.unitCtlList)
            {
                if (effectParameter.effect.animPathStart != "temp")
                {
                    GameObject effectPrefab = WarRes.GetPrefab(effectParameter.effect.animPathStart);
                    GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                    effectAnim.transform.position = unit.transform.position;
                    //DelayDestory destoryTimer = effectAnim.GetComponent<DelayDestory>();
                    //if (destoryTimer != null)
                    //{
                    //    destoryTimer.DelayTime = skillParameter.effect.time;
                    //}
                }
                //todo 沉默
                unit.unitData.AppProps(attachPropData, true);
                if (effectParameter.effect.time > 0)
                {
                    War.skillWarManager.StartCoroutine(heroSilenceSkill2Timer(effectParameter, attachPropData));
                }
                //处理技能2
                if (skillParameter.curDealSkillIdx == 1)
                {
                    War.skillWarManager.dealSkill2Effect(skillParameter);
                }
                Debug.Log(string.Format("<color=yellow> heroSilenceSkill2 to {0}  </color>",
                                        unit.unitData.id));
            }
            return(0);
        }
示例#21
0
        public void InitAttachPropData(int index)
        {
            AttachPropData attachPropData;

            if (buildFirstProp.ContainsKey(index))
            {
                attachPropData = new AttachPropData(buildFirstProp[index].FilterZero());
                buildFirstAttachPropData.Add(index, attachPropData);
            }

            if (buildInitProp.ContainsKey(index))
            {
                attachPropData = new AttachPropData(buildInitProp[index].FilterZero());
                buildInitAttachPropData.Add(index, attachPropData);
            }



            if (buildSpotConfigDict.ContainsKey(index))
            {
                attachPropData = new AttachPropData(buildSpotConfigDict[index].props);
                buildSpotAttachPropData.Add(index, attachPropData);
            }
        }
        IEnumerator stopSoldierEnd(SkillParameter skillParameter, EffectParameter effectParameter)
        {
            yield return(new WaitForSeconds(effectParameter.waitTime));

            //所有士兵显示被击效果
            //int unitType = 0;
            //unitType = unitType.USolider(true);
            //int relation = 0;
            //relation = relation.REnemy(true);
            //List<UnitCtl> unitSoldierList = War.scene.SearchUnit(unitType, effectParameter.caster.unitData.legionId, relation);
            foreach (UnitCtl unit in effectParameter.unitCtlList)
            {
                if (unit == null)
                {
                    continue;
                }
                if (unit.unitData == null)
                {
                    continue;
                }
                if (effectParameter.effect.animPathEnd != "temp")
                {
                    GameObject effectPrefab = WarRes.GetPrefab(effectParameter.effect.animPathEnd.ToLower());
                    GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                    effectAnim.transform.position = unit.transform.position;
                }
            }

            Prop[]         props          = new Prop[] { Prop.CreateInstance(PropId.StateFreezedMoveSpeed, 1) };
            AttachPropData attachPropData = new AttachPropData(props);

            Debug.LogFormat("=====stop soldier count:{0}", effectParameter.unitCtlList.Count);
            foreach (UnitCtl unit in effectParameter.unitCtlList)
            {
                if (unit == null)
                {
                    continue;
                }
                if (unit.unitData == null)
                {
                    continue;
                }


                if (unit.unitData.unitType == UnitType.Build)
                {
                    BuildSkillDots skillDots = unit.GetComponent <BuildSkillDots>();
                    if (skillDots != null)
                    {
                        skillDots.buildStopSendsoldier(effectParameter);
                    }
                }
                else
                {
                    if (effectParameter.effect.buffAnimPath != "temp")
                    {
                        GameObject effectPrefab = WarRes.GetPrefab(effectParameter.effect.buffAnimPath.ToLower());
                        GameObject effectAnim   = GameObject.Instantiate <GameObject>(effectPrefab);
                        effectAnim.transform.position = unit.transform.position;
                        DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>();
                        if (destoryTimer != null)
                        {
                            destoryTimer.DelayTime = effectParameter.value;
                        }
                    }
                    unit.unitData.AppProps(attachPropData, true);
                }
            }

            if (effectParameter.value > 0)
            {
                War.skillWarManager.StartCoroutine(stopSoldierTimer(effectParameter, attachPropData));
            }

            Debug.Log(string.Format("<color=yellow> stopSoldier all skill id={0} effid={1} {2}</color>", skillParameter.skillId, effectParameter.effect.id, effectParameter.value));
        }
示例#23
0
        /** 添加属性节点--使用附加数据 */
        public void Add(AttachPropData attachPropData)
        {
            PropNdoe node = new PropNdoe(attachPropData);

            Add(node);
        }
示例#24
0
 public PropNdoe(AttachPropData attachPropData)
 {
     this.attachPropData = attachPropData;
 }
示例#25
0
 /** 移除属性节点-- AttachPropData */
 public void Remove(AttachPropData attachPropData)
 {
     Remove(attachPropData.uid);
 }