4 protected bool m_IsRunning;
5 protected bool m_ValuesSent;
8 protected bool m_Valid =
false;
14 m_Valid = PPERequesterBank.VerifyRequester(
this);
16 m_IDX = requester_IDX;
23 void SetRequesterUpdating(
bool state)
27 Debug.Log(
"" +
this +
" not valid!");
38 void Start(
Param par =
null)
44 void Stop(
Param par =
null)
53 bool IsRequesterRunning()
59 void SetRequesterIDX(
int idx)
78 protected void SetTargetValueBool(
int mat_id,
int param_idx,
bool val,
int priority_layer,
int operator =
PPOperators.SET)
84 data.SetPriorityLayer(priority_layer);
85 data.SetInteractionMask(
operator);
87 data.m_BoolTarget = val;
88 data.m_BoolLast = data.m_BoolCurrent;
90 if (data.m_BoolTarget != data.m_BoolCurrent || data.IsSettingDefaultValues())
92 data.SetSettingDefaultValues(
false);
93 data.SetDataActive(
true);
100 protected void SetTargetValueBoolDefault(
int mat_id,
int param_idx)
107 data.m_BoolLast = data.m_BoolCurrent;
108 if (!data.IsSettingDefaultValues())
110 data.SetSettingDefaultValues(
true);
117 protected void SetTargetValueInt(
int mat_id,
int param_idx,
bool relative,
int val,
int priority_layer,
int operator =
PPOperators.SET)
122 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id,param_idx,PPEConstants.VAR_TYPE_INT));
123 data.SetPriorityLayer(priority_layer);
124 data.SetInteractionMask(
operator);
126 data.m_IntTarget = val;
127 data.m_IntLast = data.m_IntCurrent;
128 if (data.m_IntTarget != data.m_IntCurrent || data.IsSettingDefaultValues())
130 data.SetSettingDefaultValues(
false);
131 data.SetDataActive(
true);
138 protected void SetTargetValueIntDefault(
int mat_id,
int param_idx)
144 PPERequestParamDataInt data = PPERequestParamDataInt.Cast(GetRequestData(mat_id,param_idx,PPEConstants.VAR_TYPE_INT));
145 data.m_IntLast = data.m_IntCurrent;
146 if (!data.IsSettingDefaultValues())
148 data.SetSettingDefaultValues(
true);
155 protected void SetTargetValueFloat(
int mat_id,
int param_idx,
bool relative,
float val,
int priority_layer,
int operator =
PPOperators.ADD_RELATIVE)
161 data.SetPriorityLayer(priority_layer);
162 data.SetInteractionMask(
operator);
164 data.m_FloatFormerTarget = data.m_FloatTarget;
165 data.m_FloatTarget = RelativizeValue(val,PPEConstants.VAR_TYPE_FLOAT,mat_id,param_idx,relative);
166 data.m_FloatLast = data.m_FloatCurrent;
167 data.m_FloatStart = data.m_FloatCurrent;
168 if (data.m_FloatTarget != data.m_FloatCurrent || data.IsSettingDefaultValues())
170 data.SetSettingDefaultValues(
false);
171 data.SetDataActive(
true);
178 protected void SetTargetValueFloatDefault(
int mat_id,
int param_idx)
185 data.m_FloatFormerTarget = data.m_FloatTarget;
186 data.m_FloatLast = data.m_FloatCurrent;
187 data.m_FloatStart = data.m_FloatCurrent;
188 if (!data.IsSettingDefaultValues())
190 data.SetSettingDefaultValues(
true);
197 protected void SetTargetValueColor(
int mat_id,
int param_idx, ref
array<float> val,
int priority_layer,
int operator =
PPOperators.ADD_RELATIVE)
202 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id,param_idx,PPEConstants.VAR_TYPE_COLOR));
203 data.SetPriorityLayer(priority_layer);
204 data.SetInteractionMask(
operator);
205 data.m_ColorFormerTarget = data.m_ColorTarget;
207 data.m_ColorTarget.Copy(val);
209 data.m_ColorLast = data.m_ColorCurrent;
210 data.m_ColorStart = data.m_ColorCurrent;
213 data.SetSettingDefaultValues(
false);
214 data.SetDataActive(
true);
221 protected void SetTargetValueColorDefault(
int mat_id,
int param_idx)
227 PPERequestParamDataColor data = PPERequestParamDataColor.Cast(GetRequestData(mat_id,param_idx,PPEConstants.VAR_TYPE_COLOR));
228 data.m_ColorFormerTarget = data.m_ColorTarget;
229 data.m_ColorLast = data.m_ColorCurrent;
230 data.m_ColorStart = data.m_ColorCurrent;
231 if (!data.IsSettingDefaultValues())
233 data.SetSettingDefaultValues(
true);
253 protected void QueueValuesSend()
257 SetRequesterUpdating(
true);
272 data = PrepareData(mat_id,param_idx,type);
278 data = PrepareData(mat_id,param_idx,type);
280 temp_map.Set(param_idx,data);
286 Error(
"GetRequestData | no data found in the structure");
289 data.m_Requester =
this;
299 case PPEConstants.VAR_TYPE_BOOL:
303 case PPEConstants.VAR_TYPE_INT:
304 data =
new PPERequestParamDataInt(
m_IDX, mat_id, param_idx);
307 case PPEConstants.VAR_TYPE_FLOAT:
311 case PPEConstants.VAR_TYPE_COLOR:
312 data =
new PPERequestParamDataColor(
m_IDX, mat_id, param_idx);
324 protected void ClearRequesterData()
336 void OnUpdate(
float delta)
351 SetRequesterUpdating(
false);
354 protected void OnStart(
Param par =
null)
356 SetRequesterUpdating(
true);
360 protected void OnStop(
Param par =
null)
363 SetRequesterUpdating(
true);
364 SetDefaultValuesAll();
368 protected float RelativizeValue(
float value,
int var_type,
int mat_id,
int param_id,
bool relative)
375 case PPEConstants.VAR_TYPE_FLOAT:
377 ret =
Math.InverseLerp(p_float.param3, p_float.param4, ret);
378 ret =
Math.Clamp(ret,0.0,1.0);
388 protected void SetDefaultValuesAll()
399 if (!req_data.IsDataActive())
402 switch (req_data.GetVarType())
404 case PPEConstants.VAR_TYPE_BOOL:
405 SetTargetValueBoolDefault(req_data.GetMaterialID(),req_data.GetParameterID());
408 case PPEConstants.VAR_TYPE_INT:
409 SetTargetValueIntDefault(req_data.GetMaterialID(),req_data.GetParameterID());
412 case PPEConstants.VAR_TYPE_FLOAT:
413 SetTargetValueFloatDefault(req_data.GetMaterialID(),req_data.GetParameterID());
416 case PPEConstants.VAR_TYPE_COLOR:
417 SetTargetValueColorDefault(req_data.GetMaterialID(),req_data.GetParameterID());
424 void DbgPrnt(
string text)