public virtual bool InitSkillInfo(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { var guid = BattleModule.BattleID; //var time = self.GetSkillTime(skillConfig); var skillId = self.GetSkillID(skillConfig); //var nowTime = self.GetNowTime(); //var activeNum = self.GetActiveNum(skillConfig); self.SetSkillId(skillInfo, skillId); //self.SetSkillTime(skillInfo, time); self.SetSkillGuid(skillInfo, guid); //self.SetSkillStateTime(skillInfo, nowTime); //self.SetSkillSrcObj(skillInfo, self); //self.SetActiveNum(skillInfo, activeNum); self.SetSkillStateIndex(skillInfo, 0); var startLogicStateName = self.GetLogicState(skillConfig, 0); var startLogicState = BattleModule.GetSkillLogicState(startLogicStateName); if (startLogicState == null) { self.LogInfo("startLogicState == null skillId:[{0}] startLogicStateName:[{1}]".F(skillId, startLogicStateName)); return(false); } //init startLogicState.InitSkill(self, skillInfo, skillConfig, 0); startLogicState.InitState(self, skillInfo, skillConfig, 0); var targetSelectName = self.GetTargetSelect(skillConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(skillId, targetSelectName)); return(false); } targetSelect.Init(self, skillInfo, skillConfig); return(true); }
public virtual void Tick(SkillObj self, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { if (!CommonCheck(self, skillInfo, skillConfig)) { return; } var logicState = BattleModule.GetSkillLogicState(skillInfo, self); if (logicState == null) { return; } var ret = logicState.Tick(self, skillInfo, skillConfig); switch (ret) { case LogicStateTickRet.TimeFinish: SkillOnEnd(self, skillInfo, skillConfig); break; case LogicStateTickRet.NextState: int index = self.GetSkillStateIndex(skillInfo); string nextStateName = self.GetLogicState(skillConfig, ++index); if (nextStateName == null || nextStateName.Equals("")) { SkillOnEnd(self, skillInfo, skillConfig); return; } var nextLogicState = BattleModule.GetSkillLogicState(nextStateName); if (nextLogicState == null) { self.LogInfo("startLogicState {0} not found".F(nextStateName)); return; } double fixTime = logicState.OnStateChanged(nextStateName, self, skillInfo, skillConfig); self.SetSkillStateIndex(skillInfo, index); nextLogicState.InitState(self, skillInfo, skillConfig, fixTime); self.NotifySkillInfo(skillInfo, BattleInfoNotifyType.ChangeState_Skill, BattleNotifyTime.TickEnd); break; case LogicStateTickRet.OnEffect: //var srcObj = self.GetSkillSrcObj(skillInfo); { var targetSelectName = self.GetTargetSelect(skillConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null skillId:[{0}] targetSelectName:[{1}]".F(self.GetSkillID(skillInfo), targetSelectName)); return; } var targetTypeName = self.GetTargetType(skillConfig); var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null skillId:[{0}] targetType:[{1}]".F(self.GetSkillID(skillInfo), targetTypeName)); return; } var targets = BattleModule.GetTargets(self, targetSelect, targetType, skillInfo, skillConfig); foreach (var tar in targets) { OnEffect(self, tar, skillInfo, skillConfig); } } break; } }