/// <summary>マップ移動前のイベント実行</summary> public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { //移動先の座標計算 calculatePercentagePosition(aOperator); //マップ移動通知 aOperator.mDelegate.onMoveMap(this); //現在のマップのイベントKeyに対応したイベント取得 if (mHereEventKey != null && mHereEventKey != "") { mEndSide.mHereEvent = aOperator.parent.mWorld.mEvents[mHereEventKey]; } //フェードアウト移動 if (mMoveOutSpeed > 0) { //移動する aOperator.getAi("invoker").moveBy(mMoveOutVector, mMoveOutSpeed, () => { }); } else if (mMoveOutVector != Vector3.zero) { //向きのみ変更 aOperator.getAi("invoker").parent.mCharacterImage.setDirection(mMoveOutVector); } //フェードアウト aOperator.mDelegate.onMoveMapFadeOut(() => { fadeOutEnded(aOperator); }); }
/// <summary>マップ移動のフェードアウト演出とキャラ移動演出終了時</summary> private void fadeInEnded(MapEventSystem.Operator aOperator) { //入り口データが指定するイベント実行 if (mEntranceEvent != null) { ++mRunningEventNum; mEntranceEvent.run(aOperator, (arg) => { endCompanionEvent(); }); } //マップ移動イベントが指定するイベント実行 if (mDestinationEvent != null) { ++mRunningEventNum; mDestinationEvent.run(aOperator, (arg) => { endCompanionEvent(); }); } //移動前のマップに定義されているイベント実行 if (mHereEvent != null) { ++mRunningEventNum; mHereEvent.run(aOperator, (arg) => { endCompanionEvent(); }); } //マップ生成と同時に実行するイベントのみ実行し、かつこの時既に実行が完了していた場合の対策 mAllCompanionEventIsStarted = true; ++mRunningEventNum; endCompanionEvent(); }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { Vector2 tDirection = aOperator.getCharacter(mTo).mMapPosition.vector2 - aOperator.getCharacter(mTarget).mMapPosition.vector2; aOperator.getAi(mTarget).turn(tDirection); aCallback(null); }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { aOperator.mDelegate.onEncount(mMapName, mEncountKey, (aResult) => { aCallback(new Arg(new Dictionary <string, object>() { { "result", aResult } })); ; }); }
/// <summary>移動先の座標計算</summary> private void calculatePercentagePosition(MapEventSystem.Operator aOperator) { //triggerの矩形範囲 ColliderEditer.CubeEndPoint tRange = aOperator.mInvokedCollider.minimumCircumscribedCubeEndPoint(); //invokerのcolliderを考慮して矩形範囲を調整 ColliderEditer.CubeEndPoint tSize = aOperator.mInvoker.mEntityPhysicsBehaviour.mAttriubteCollider.minimumCircumscribedCubeEndPoint(); tRange.left -= tSize.left; tRange.right -= tSize.right; tRange.top -= tSize.top; tRange.bottom -= tSize.bottom; tRange.back -= tSize.back; tRange.front -= tSize.front; Vector3 tRelative = aOperator.mInvoker.mEntityPhysicsBehaviour.mAttribute.worldPosition - aOperator.mInvokedCollider.transform.position; Vector3 tRangePosition = new Vector3((tRelative.x - tRange.left) / (tRange.right - tRange.left), (tRelative.y - tRange.bottom) / (tRange.top - tRange.bottom), (tRelative.z - tRange.front) / (tRange.back - tRange.front)); //座標が(0~1)の範囲になるように調整 if (tRangePosition.x < 0) { tRangePosition.x = 0; } else if (1 < tRangePosition.x) { tRangePosition.x = 1; } if (tRangePosition.y < 0) { tRangePosition.y = 0; } else if (1 < tRangePosition.y) { tRangePosition.y = 1; } if (tRangePosition.z < 0) { tRangePosition.z = 0; } else if (1 < tRangePosition.z) { tRangePosition.z = 1; } mEndSide.mPercentagePosition = tRangePosition; }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { int tNum = mEventList.Count; int tEndNum = 0; Action f = () => { ++tEndNum; if (tNum == tEndNum) { aCallback(new Arg()); } }; foreach (MapEvent tEvent in mEventList) { tEvent.run(aOperator, (aArg) => { f(); }); } }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { int tLength = mEventList.Count; int i = 0; Action f = () => { }; f = () => { if (tLength <= i) { aCallback(new Arg()); return; } MapEvent tEvent = mEventList[i]; tEvent.run(aOperator, (aArg) => { ++i; f(); }); }; f(); }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { aOperator.mDelegate.onEvent(mData, (a) => { if (a == null) { aCallback(null); return; } if (a is string) { mEventDic[(string)a].run(aOperator, aCallback); return; } if (a is MapEvent) { ((MapEvent)a).run(aOperator, aCallback); return; } Debug.LogWarning("MapEventForwardDelegate : 未定義の戻り値「" + a.GetType().ToString() + "」"); aCallback(null); }); }
/// <summary>マップ移動後のイベント実行</summary> public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { mEventEndCallback = aCallback; //マップ生成完了と同時に実行するイベントの実行 if (mEntranceData.mFirstEventKey != "") { mFirstEvent = aOperator.parent.mWorld.mEvents[mEntranceData.mFirstEventKey];//イベント取得 if (!aOperator.jackRequared(mFirstEvent)) { throw new Exception("MapEventMoveMapEndSide : FirstEventが求めるAIのジャックに失敗"); } //実行 ++mRunningEventNum; mFirstEvent.run(aOperator, (arg) => { endCompanionEvent(); }); } //フェードイン完了後に実行するイベントの準備 if (mDestinationEventKey != "" && mDestinationEventKey != null) { mDestinationEvent = aOperator.parent.mWorld.mEvents[mDestinationEventKey];//イベント取得 if (!aOperator.jackRequared(mDestinationEvent)) { throw new Exception("MapEventMoveMapEndSide : DestinationEventが求めるAIのジャックに失敗"); } } if (mHereEvent != null) { if (!aOperator.jackRequared(mHereEvent)) { throw new Exception("MapEventMoveMapEndSide : HereEventが求めるAIのジャックに失敗"); } } if (mEntranceData.mEventKey != "") { mEntranceEvent = aOperator.parent.mWorld.mEvents[mEntranceData.mEventKey];//イベント取得 if (!aOperator.jackRequared(mEntranceEvent)) { throw new Exception("MapEventMoveMapEndSide : EntranceEventが求めるAIのジャックに失敗"); } } bool tMoveEnded = false; bool tFadeEnded = false; //フェードイン移動 if (mEntranceData.mMoveSpeed > 0) { //移動する aOperator.getAi("invoker").moveBy(mEntranceData.mMoveVector, mEntranceData.mMoveSpeed, () => { tMoveEnded = true; if (tFadeEnded) { fadeInEnded(aOperator); } }); } else if (mEntranceData.mMoveVector != Vector2.zero) { //向きのみ変更 aOperator.getAi("invoker").parent.mCharacterImage.setDirection(mEntranceData.mMoveVector); tMoveEnded = true; } //フェードイン aOperator.mDelegate.onMoveMapFadeIn(() => { tFadeEnded = true; if (tMoveEnded) { fadeInEnded(aOperator); } }); }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { aOperator.getAi(mTarget).turn(mDirection); aCallback(null); }
/// <summary>マップ移動のフェードアウト演出終了時</summary> private void fadeOutEnded(MapEventSystem.Operator aOperator) { mPlayerDirection = aOperator.getCharacter("player").mCharacterImage.getDirection(); aOperator.parent.mWorld.mMap.moveMap(this); }
/// <summary> /// イベント実行 /// </summary> /// <param name="aOperator">イベント処理するoperator</param> /// <param name="aCallback">イベント処理終了時コールバック</param> public abstract void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback);
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { aOperator.getAi(mTarget).moveBy(mVector, mSpeed, () => { aCallback(null); }); }
public override void run(MapEventSystem.Operator aOperator, Action <Arg> aCallback) { mEvent.run(aOperator, aCallback); }