public static PhxRuntimeEnvironment Create(PhxPath envPath, PhxPath fallbackPath = null, bool initMatch = true) { if (!envPath.Exists()) { Debug.LogErrorFormat("Given environment path '{0}' doesn't exist!", envPath); return(null); } if (fallbackPath == null) { fallbackPath = envPath; } Debug.Assert(fallbackPath.Exists()); PhxAnimationLoader.ClearDB(); GameLuaEvents.Clear(); PhxRuntimeEnvironment rt = new PhxRuntimeEnvironment(envPath, fallbackPath); rt.ScheduleLVLRel("core.lvl"); rt.ScheduleLVLRel("shell.lvl"); rt.ScheduleLVLRel("common.lvl"); rt.ScheduleLVLRel("mission.lvl"); rt.ScheduleSoundBankRel("sound/common.bnk"); rt.RTScene = new PhxRuntimeScene(rt, rt.EnvCon); rt.Match = initMatch ? new PhxRuntimeMatch() : null; rt.Timers = new PhxTimerDB(); PhxAnimationLoader.Con = rt.EnvCon; return(rt); }
void ApplyTeam(int oldTeam) { if (Team == oldTeam) { // nothing to do return; } CaptureTimer = 0.0f; AudioCapture.clip = Team == 0 ? C.ChargeSound.Get <AudioClip>(0) : C.DischargeSound.Get <AudioClip>(0); AudioCapture.Play(); AudioAmbient.loop = true; AudioAction.clip = Team == 0 ? C.LostSound.Get <AudioClip>(0) : C.CapturedSound.Get <AudioClip>(0); AudioAction.Play(); HoloPresence = 0.0f; HoloPresenceDest = 1.0f; if (Team == 0) { GameLuaEvents.Invoke(GameLuaEvents.Event.OnFinishNeutralize, Scene.GetInstanceIndex(this)); } else { GameLuaEvents.Invoke(GameLuaEvents.Event.OnFinishCapture, Scene.GetInstanceIndex(this)); GameLuaEvents.Invoke(GameLuaEvents.Event.OnFinishCaptureName, name, Scene.GetInstanceIndex(this)); } RefreshCapture(); UpdateColor(); }
public void Tick(float deltaTime) { for (int i = 0; i < InUseIndices.Count; ++i) { int idx = InUseIndices[i]; if (Timers[idx].IsRunning) { Timers[idx].Time -= Timers[idx].Rate * deltaTime; if (Timers[idx].Time <= 0f) { GameLuaEvents.InvokeParameterized(GameLuaEvents.Event.OnTimerElapse, idx); Timers[idx].Time = 0f; Timers[idx].IsRunning = false; } } } }
public static void OnFinishNeutralize(PhxLuaRuntime.LFunction callback) { GameLuaEvents.Register(GameLuaEvents.Event.OnFinishNeutralize, callback); // callback paramters: // - postPtr }
public static void OnFinishCaptureName(PhxLuaRuntime.LFunction callback, string cpName) { GameLuaEvents.Register(GameLuaEvents.Event.OnFinishCaptureName, callback, cpName); // callback paramters: // - postPtr }
public static void OnLeaveRegion(PhxLuaRuntime.LFunction callback, string regionName) { GameLuaEvents.Register(GameLuaEvents.Event.OnLeaveRegion, callback, regionName); }
public static void OnEnterRegionTeam(PhxLuaRuntime.LFunction callback, string regionName, int teamIdx) { GameLuaEvents.Register(GameLuaEvents.Event.OnEnterRegionTeam, callback, (regionName, teamIdx)); }
public static void OnTimerElapse(PhxLuaRuntime.LFunction callback, int timer) { GameLuaEvents.Register(GameLuaEvents.Event.OnTimerElapse, callback, timer); }