protected override ErrorCode doStart(ActionInitParam param) { ActionSkillInitParam asInit = param as ActionSkillInitParam; mSkillUsing = asInit.skill; mSkillUseStateLoopLeft = mSkillUsing.skillRes.skillUseStateLoopLeft; mTaskManager = new SkillUtilities.TaskManager(onTaskFinished); mOwner.EnterFightState(); if (IsRegularAttack) { //如果是普通攻击,武器播放射击动画 mOwner.PlayWeaponAnim(AnimationNameDef.WeaponFire); } if (mOwner.IsCanRotation() && mSkillUsing.skillRes.autoAim) { ownerLookAt(asInit.targetPosition); } SkillTargetPosition = asInit.targetPosition; switch2State(ActionSkillState.Invalid); return(canEnterState(ActionSkillState.Charging, asInit.targetPosition)); }
protected override ErrorCode doStart(SkillEffectInitParam param) { // 如果单位免疫控制, 且该buff为控制类buff, 那么, 该buff不能被添加, // 无论该buff有什么其它的功能. if (!mOwner.CanBeStuned() && mBuffRes.IsStunBuff) { return(ErrorCode.AddEffectFailedSkillEffectImmunity); } if (mBuffRes.dotEffectTimeInterval != uint.MaxValue) { mTaskManager = new SkillUtilities.TaskManager(onTaskFinished); } mProperties = SkillUtilities.ParseProperties(mBuffRes.properties); mSkillTransform = SkillUtilities.ParseSkillTransform(mBuffRes.skillTransform); return(base.doStart(param)); }
public override bool Init(ObjectInitParam param) { if (!base.Init(param)) { return(false); } TrapInitParam trapInit = (TrapInitParam)param; if (!DataManager.TrapTable.ContainsKey(trapInit.trapResID)) { return(false); } mTrapResource = DataManager.TrapTable[trapInit.trapResID] as TrapTableItem; mModelResID = (int)mTrapResource.modelID; mSummonerAttr = trapInit.summonerAttr; // 没有召唤者. if (mSummonerAttr.AttackerID == uint.MaxValue) { mSummonerAttr = new AttackerAttr(this, mSummonerAttr.SkillCommonID, mSummonerAttr.StructMadeByRandEvent); } mTaskManager = new SkillUtilities.TaskManager(null); // 生命时间结束后, 进入倒计时死亡. mTaskManager.AddTask(new SkillUtilities.Task(trapInit.lifeTime, explodeCountBackwards, null)); // 倒计时死亡之后, 再经过爆炸延迟, 开始爆炸. uint explodeTime = uint.MaxValue; // 避免累加时溢出. if (trapInit.lifeTime != uint.MaxValue && mTrapResource.explodeDelay != uint.MaxValue) { explodeTime = trapInit.lifeTime + mTrapResource.explodeDelay; } mTaskManager.AddTask(new SkillUtilities.Task(explodeTime, explode, null)); mTaskManager.Start(); return(true); }