Files
caliverse_server/GameServer/Contents/GameMode/Mode-Running/ModeRace/Manage/GameModeRunRace.cs
2025-05-01 07:23:28 +09:00

88 lines
2.4 KiB
C#

using GameServer.Contents.GameMode.Helper;
using GameServer.Contents.GameMode.Mode_Running.Manage;
using GameServer.Contents.GameMode.Mode_Running.ModeRace.Actions;
using ServerBase;
using ServerCommon;
using ServerCore;
namespace GameServer;
public class GameModeRunRace<T> : GameModeRun where T : IRunningMode
{
T m_run_mode_data;
public GameModeRunRace(T runModeData, InstanceRoom instanceRoom) : base(EntityType.GameModeRunRace, instanceRoom)
{
Log.getLogger().debug("run race constructor called");
m_run_mode_data = runModeData;
Log.getLogger().debug("run race constructor done");
}
public override Task<Result> onInit()
{
Log.getLogger().debug("run race onInit called");
//제너릭 init
m_run_mode_data.initRunningMode();
//레이스 모드에 필요한 액션 추가
addRaceEntityAction();
//게임 모드에 필요한 상수값 입력
setDefaultMetaConstants();
//다 마무리 되면 부모 init 호출
var result = base.onInit();
Log.getLogger().debug("run race onInit done");
return result;
}
public override Task initAfterTimerCreate()
{
m_current_game_mode_state = new RaceStateReady(this);
return Task.CompletedTask;
}
private void addRaceEntityAction()
{
Log.getLogger().debug("run race addEntityAction called");
addEntityAction(new RaceStateCheckAction(this));
addEntityAction(new RaceGameObjectSavePointInteractAction(this));
Log.getLogger().debug("run race addEntityAction done");
}
private void setDefaultMetaConstants()
{
m_ticker_interval_msecs = GameModeConstants.GAME_MODE_RUN_RACE_CHECK_INTERVAL_MSECS;
}
public override async Task taskUpdate()
{
var state_check_action = getEntityAction<RaceStateCheckAction>();
NullReferenceCheckHelper.throwIfNull(state_check_action, () => $"location attribute is null !!");
var result = await state_check_action.stateUpdate();
if (result.isFail()) return;
}
public override string toBasicString()
{
var basic_string = base.toBasicString() + $"GameModeRunRace....roomId : {getRoomId()}";
return basic_string;
}
}