24 protected ref set<UndergroundTrigger>
m_InsideTriggers =
new set<UndergroundTrigger>();
41 m_NVRequester = PPERequester_CameraNV.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_CAMERANV));
48 g_Game.GetWorld().SetExplicitVolumeFactor_EnvSounds2D(1, 0.5);
49 g_Game.GetWeather().SuppressLightningSimulation(
false);
50 g_Game.GetWorld().SetUserLightingLerp(0);
60 m_Requester = PPERUndergroundAcco.Cast(PPERequesterBank.GetRequester( PPERequesterBank.REQ_UNDERGROUND));
98 float closestDist =
float.MAX;
109 vector crumbPosition = crumb.GetPosition();
114 switch (crumb.ExternalValueController.Type)
119 if (!ctrl || (ctrl && ctrl.SelectionName ==
""))
126 float animPhase = building.GetAnimationPhase(ctrl.SelectionName);
135 if (crumbRadius != -1)
136 maxRadiusAllowed = crumbRadius;
137 if (dist > maxRadiusAllowed)
138 excludeMask = (excludeMask | (1 << indx));
141 vector rayStart = MiscGameplayFunctions.GetPlayerHeadPosition(
m_Player);
142 vector rayEnd = crumbPosition;
149 excludeMask = (excludeMask | (1 << indx));
153 distances.Insert(dist);
155 #ifdef DIAG_DEVELOPER
161 float baseDst = distances[0];
164 foreach (
float dst:distances)
168 float dstInv = (baseDst / dst) * baseDst;
170 distancesInverted.Insert(dstInv);
175 foreach (
int i,
float dstInvert:distancesInverted)
177 if ((1 << i) & excludeMask)
180 float ratio = dstInvert / sum;
186 #ifdef DIAG_DEVELOPER
189 float intensity = (1-ratio) * 255;
204 JsonUndergroundAreaBreadcrumb startPoint = points[0];
205 JsonUndergroundAreaBreadcrumb endPoint = points[points.Count() - 1];
211 float accoMin = endPoint.EyeAccommodation;
212 JsonUndergroundAreaBreadcrumb closestPoint;
213 JsonUndergroundAreaBreadcrumb secondaryPoint;
214 float distanceToClosest;
215 float distanceToSecondary;
216 float distanceBetweenPoints;
218 foreach (JsonUndergroundAreaBreadcrumb point : points)
221 if (!closestPoint || dist < distanceToClosest)
225 secondaryPoint = closestPoint;
226 distanceToSecondary = distanceToClosest;
228 closestPoint = point;
229 distanceToClosest = dist;
231 else if (!secondaryPoint || dist < secondaryPoint)
233 secondaryPoint = point;
234 distanceToSecondary = dist;
237 #ifdef DIAG_DEVELOPER
243 distanceBetweenPoints =
vector.
DistanceSq(closestPoint.GetPosition(), secondaryPoint.GetPosition());
245 if (closestPoint == startPoint && secondaryPoint == points[1] && distanceToSecondary > distanceBetweenPoints)
247 else if (closestPoint == endPoint && secondaryPoint == points[points.Count() - 2] && distanceToSecondary > distanceBetweenPoints)
251 if (closestPoint == endPoint)
252 secondaryPoint = points[points.Count() - 2];
253 else if (closestPoint == startPoint)
254 secondaryPoint = points[1];
255 else if (distanceBetweenPoints < distanceToClosest || distanceBetweenPoints < distanceToSecondary)
257 JsonUndergroundAreaBreadcrumb nexPoint = points[points.Find(closestPoint) + 1];
259 secondaryPoint = nexPoint;
262 acco = closestPoint.EyeAccommodation;
269 distanceToSecondary =
vector.
DistanceSq(playerPos, secondaryPoint.GetPosition());
271 acco = distanceToSecondary / (distanceToClosest + distanceToSecondary);
272 acco =
Math.
Lerp(secondaryPoint.EyeAccommodation, closestPoint.EyeAccommodation, acco);
274 if (points.Find(closestPoint) > points.Find(secondaryPoint))
298 #ifdef DIAG_DEVELOPER
301 vector headPosition = MiscGameplayFunctions.GetPlayerHeadPosition(
m_Player);
303 if (acco != accoMin && acco != accoMax)
308 DbgUI.
Text(
String(
"Second closest id: " + points.Find(secondaryPoint)));
319 if(reachedTarget && !
m_Player.m_UndergroundPresence)
338 g_Game.GetWorld().SetUserLightingLerp(0);
369 #ifdef DIAG_DEVELOPER
380 #ifdef DIAG_DEVELOPER
393 float undergrounNVExposureCoef =
m_EyeAcco;
396 undergrounNVExposureCoef = 1.0;
431 EUndergroundTriggerType bestType = EUndergroundTriggerType.UNDEFINED;
433 UndergroundTrigger bestTrigger;
439 if (t.m_Type > bestType)
451 if (bestTrigger.m_Type == EUndergroundTriggerType.TRANSITIONING)
456 if (bestTrigger.m_InterpolationSpeed != -1 && bestTrigger.m_InterpolationSpeed != 0)
470 newPresence = trigger.TranslateTriggerTypeToPresence();
472 if (newPresence != oldPresence)
475 m_Player.SetUnderground(newPresence);
483 light.SetVisibleDuringDaylight(enable);
554 g_Game.GetWeather().SuppressLightningSimulation(
true);
570 g_Game.GetWeather().SuppressLightningSimulation(
false);
578 g_Game.GetWorld().SetUserLightingLerp(0);
584 #ifdef DIAG_DEVELOPER
585 protected void DisplayDebugInfo(
float acco,
float lighting)
589 DbgUI.Begin(
String(
"Underground Areas"), 20, 20);
enum ParticleAutoDestroyFlags FULL
Mode for GetParticle.
void BreadcrumbDoorStateController(TStringArray params)
bool CalculateEyeAcco(float timeSlice)
void UndergroundHandlerClient(PlayerBase player)
ref AnimationTimer m_AnimTimerLightBlend
const float DEFAULT_INTERPOLATION_SPEED
const float DISTANCE_CUTOFF
void OnTriggerLeave(UndergroundTrigger trigger)
string m_AmbientController
UndergroundTrigger m_TransitionalTrigger
PPERUndergroundAcco m_Requester
void UpdateNVGRequester(float value)
const float ACCO_MODIFIER
void CalculateEyeAccoTarget()
ref set< UndergroundTrigger > m_InsideTriggers
enum EUndergroundPresence LIGHT_BLEND_SPEED_IN
PPERUndergroundAcco GetRequester()
EffectSound m_AmbientSound
void CalculateLinePointFade()
void OnTriggerInsiderUpdate()
UndergroundTrigger m_BestTrigger
void CalculateBreadCrumbs()
void ProcessLighting(float timeSlice)
void EnableLights(bool enable)
float m_LightingLerpTarget
const float LIGHT_BLEND_SPEED_OUT
void ~UndergroundHandlerClient()
void OnUndergroundPresenceUpdate(EUndergroundPresence newPresence, EUndergroundPresence oldPresence)
PPERequester_CameraNV m_NVRequester
float m_AccoInterpolationSpeed
void OnTriggerEnter(UndergroundTrigger trigger)
void ProcessEyeAcco(float timeSlice)
const string UNDERGROUND_LIGHTING
void SetUndergroundPresence(UndergroundTrigger trigger)
AnimationTimer class. This timer is for animating float value. usage:
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
static float EaseInQuint(float t)
static float EaseInOutQuint(float t)
static float EaseOutCubic(float t)
Input value between 0 and 1, returns value adjusted by easing, no automatic clamping of input(do your...
Wrapper class for managing sound through SEffectManager.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput=true)
Returns given value remaped from input range into output range.
static proto float AbsFloat(float f)
Returns absolute value.
@ NONE
body is not in simulation, nor in collision world
SetSoundControllerOverride(string controllerName, float value, SoundControllerAction action)
int ARGB(int a, int r, int g, int b)