public void StateFunctionWork(BattleRoleData source, BattleRoleData target , RoleAttributeList ral, RoleBarChart bc , int dmg, int lastTime) { OneStateController state = new OneStateController() { ID = NAME + "#" + stateTag.ToString().ToUpper(), NAME = NAME, LastTime = stateEndType == StateEndType.time ? lastTime : 1, RAL = ral, BarChart = bc, ExtraDmg = dmg, StateTag = stateTag, }; if (target.AddStandardState(state)) { Debug.Log("对 " + target.name + "添加 状态(sstate)" + state.NAME + " 成功"); } }
public IEnumerator IEStartSkill(BattleRoleData source, BattleRoleData target , NumberData _val, int lastTime) { source.unit_character_model.CurrentCharacterModel.ChangeModelAnim (source.unit_character_model.CurrentCharacterModel.anim_cast, false); SLEffectManager.Instance.playCommonEffectCast(source.transform.position); yield return(new WaitForSeconds(castLastTime)); SLEffectManager.Instance.playCommonEffectLocalBarChartAdd(target.transform.position); yield return(new WaitForSeconds(effectLastTime)); source.unit_character_model.CurrentCharacterModel .ChangeModelAnim(source.unit_character_model.CurrentCharacterModel.anim_idle, true); int val = _val.DATA; if (_val.dataTag == NumberData.DataType.percent) { val = (int)(target.HpController.MaxHp * _val.DECIMAL); } //target.ControlRegendVisual(_stateTag, lastTime,val); OneStateController state = new OneStateController() { ID = name + "#" + _stateTag.ToString().ToUpper(), NAME = name, BarChart = new RoleBarChart() { HP = val, }, StateTag = StateTag.End, LastTime = lastTime, }; if (target.AddStandardState(state)) { Debug.Log(source.name + " heal cause " + val + " to " + target.name); } yield return(new WaitForSeconds(skillLastTime)); StartCoroutine(IEWaitForShortEnd(source)); }
public bool AddStandardState(OneStateController state) { if (CurrentStateList.Exists(x => x.ID == state.ID)) { return(false); } if (CurrentStateList.Count < SDConstants.UnitStateVolume) { CurrentStateList.Add(state); return(true); } else { for (int i = 0; i < CurrentStateList.Count; i++) { if (CurrentStateList[i].CanSqueeze) { CurrentStateList.RemoveAt(i); CurrentStateList.Add(state); return(true); } } return(false); } }