protected override ErrorCode doStart(ActionInitParam param) { ActionReloadInitParam reloadParam = (ActionReloadInitParam)(param); if (reloadParam == null) { return(ErrorCode.ConfigError); } mWeaponResID = reloadParam.weaponid; if (mWeaponResID < 0) { return(ErrorCode.ConfigError); } if (!DataManager.WeaponTable.ContainsKey(mWeaponResID)) { GameDebug.LogError("ActionReload 未找到武器 id = " + mWeaponResID.ToString()); return(ErrorCode.ConfigError); } WeaponTableItem item = DataManager.WeaponTable[mWeaponResID] as WeaponTableItem; mWaiting = true; mWaitTime = (int)item.reload_interval; mReloadTime = (int)item.reload_time; mOwner.AddActiveFlag(ActiveFlagsDef.DisableSkillUse, true, true); return(base.doStart(param)); }
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)); }
public ErrorCode Start(ActionInitParam param) { ErrorCode ret = canStart(param); if (ret != ErrorCode.Succeeded) { return(ret); } if (IsRunning) { Stop(false); } IsRunning = false; ErrorCode err = doStart(param); if (err != ErrorCode.Succeeded) { return(err); } IsRunning = true; onStarted(); return(ErrorCode.Succeeded); }
public ErrorCode Restart(ActionInitParam param) // 不停止动画 { if (param == null) { return(ErrorCode.InvalidParam); } if (param.GetType() != typeof(ActionMoveInitParam)) { return(ErrorCode.InvalidParam); } ActionMoveInitParam thisParam = (ActionMoveInitParam)param; if (thisParam.wayOrDir) { mPathNodes = thisParam.wayPoint; mCurrentIndex = 0; mMoveMode = MOVE_MODE.MOVE_MODE_WAY; } else { mMoveMode = MOVE_MODE.MOVE_MODE_DIRECTION; mMoveDirection = thisParam.dir; mOwner.SetMoveDirection(mMoveDirection); } return(ErrorCode.Succeeded); }
protected override ErrorCode doStart(ActionInitParam param) { ErrorCode err = base.doStart(param); if (err != ErrorCode.Succeeded) { return(err); } ActionDisplacementInitParam displacementInit = param as ActionDisplacementInitParam; mDisplacementResource = displacementInit.displacementResource; if (mDisplacementResource.leagueSelectionOnExecute != LeagueSelection.None && mDisplacementResource.skillEffect2OthersOnExecute != uint.MaxValue) { mTargetSelectionOnExecute = new TargetSelectionTableItem() { resID = -1, desc = "displacement hit", leagueSel = mDisplacementResource.leagueSelectionOnExecute, maxTargetCount = uint.MaxValue, shape = ShapeType.ShapeType_Rect, RectLength = mDisplacementResource.radiusOnCollide * 2 } } ; return(ErrorCode.Succeeded); }
protected override ErrorCode doStart(ActionInitParam param) { mActive = true; toState(IdleStateDef.Rest); return(base.doStart(param)); }
protected override ErrorCode doStart(ActionInitParam param) { ActionSpasticityInitParam initParam = param as ActionSpasticityInitParam; spasticityRes = initParam.spasticityRes; spasticityBackswing = uint.MaxValue; return(base.doStart(param)); }
protected override ErrorCode canStart(ActionInitParam param) { // 距离等检测放到技能使用时. ActionSkillInitParam skillParam = param as ActionSkillInitParam; if (skillParam == null) { return(ErrorCode.LogicError); } return(ErrorCode.Succeeded); }
protected override ErrorCode doStart(ActionInitParam param) { if (param == null) { return(ErrorCode.InvalidParam); } if (param.GetType() != typeof(ActionMoveInitParam)) { return(ErrorCode.InvalidParam); } return(Restart(param)); }
protected override ErrorCode doStart(ActionInitParam param) { ActionQuickMoveInitParam quickMoveInit = param as ActionQuickMoveInitParam; if (quickMoveInit == null) { return(ErrorCode.LogicError); } mAttackerAttr = quickMoveInit.mAttackerAttr; mQuickMoveDirection = quickMoveInit.targetPosition - mOwner.GetPosition(); mQuickMoveDirection.y = 0; mController = new SkillUtilities.QuickMoveController(mOwner.GetPosition(), mQuickMoveDirection, mQuickMoveDirection.magnitude); return(ErrorCode.Succeeded); }
/// <summary> /// 开启一个Action, 并且将它加入到Update队列中. /// </summary> /// ? public ErrorCode StartAction(ActionInitParam param) { if (param == null) { return(ErrorCode.InvalidParam); } if (param.GetType() == typeof(ActionMoveInitParam)) { ActionMove actionMove = GetActionByType(ActionTypeDef.ActionTypeMove) as ActionMove; if (actionMove != null) { return(actionMove.Restart(param)); } } if (GetActionByType(param.ActionType) != null) { ErrorHandler.Parse(ErrorCode.ConfigError, "only one " + param.ActionType + " can run"); return(ErrorCode.ConfigError); } Action action = BattleUnitActionFactory.Instance.Allocate(param.ActionType); if (action == null) { return(ErrorCode.LogicError); } action.Owner = mActionOwner; ErrorCode err = action.Start(param); if (err == ErrorCode.Succeeded) { mActionContainer[(int)param.ActionType] = action; IdleAction.SetActive(false); } return(err); }
protected override ErrorCode doStart(ActionInitParam param) { ActionDieInitParam initParam = param as ActionDieInitParam; if (!mOwner.IsDead()) { return(ErrorCode.LogicError); } // 禁止攻击/移动/使用技能, 并停止当前的此类Action. mOwner.AddActiveFlag(ActiveFlagsDef.DisableAttack, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableMovement, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableSkillUse, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.DisableRotate, true, true); mOwner.AddActiveFlag(ActiveFlagsDef.Inviolability, true, false); mDeathBehaviour = new DeathBehaviour(); mDeathBehaviour.Start(mOwner, initParam.damageType, initParam.attackerAttr); return(base.doStart(param)); }
protected virtual ErrorCode canStart(ActionInitParam param) { return(ErrorCode.Succeeded); }