// Update is called once per frame void Update() { dist = Vector3.Distance(Camera.main.transform.position, Vector3.zero); dist2 = DLUtility.remap(dist, size - fadeDist, size, 0, .5f); white.a = dist2; mat.SetColor("_Color", white); }
// Update is called once per frame void Update() { dist = 1 - PlayerPrefs.GetFloat("distance"); for (int i = 0; i < audios.Length; i++) { float div = (float)i / (float)audios.Length; audios [i].volume = DLUtility.clamp(dist - div, 0, 1); } }
// Update is called once per frame void Update() { float distance = Mathf.Clamp(dist.distance, nearDistance, farDistance); distance = DLUtility.remap(distance, nearDistance, farDistance, 0, 1); scale = Mathf.Lerp(nearScale, farScale, distance); init.a = scale; mat.SetColor("_Color", init); // Debug.Log (dist.distance); }
public void Slide() { slide = slider; if (!manualSet) { distToCam = dist.distance; slide = DLUtility.remap(distToCam, distances.x, distances.y, distances.z, distances.w); } for (int i = 0; i < skins.Length; i++) { skins [i].SetBlendShapeWeight(0, slide * 100); } // if (LODDid [0]) { // HighResWings (); // LODDid [0] = false; // } // else if (LODDid [1]) { // LowResWings (); // LODDid [1] = false; // } // else if (LODDid [2]) { // Deacti (); // LODDid [1] = false; // } if (slide >= 1 && wingsActive) { DeactivateWings(); } else if (slide < .5f && !wingsActive) { ActivateWings(); } if (wingsActive) { float newSlide = Mathf.Clamp(1 - slide, 0, 1); flapCount += Time.deltaTime * flapSpeed; scalar.Set(newSlide, newSlide, newSlide); leftWingRotation.Set(0, 0, Mathf.Sin(flapCount) * flapAmount); rightWingRotation.Set(0, 0, Mathf.Sin(-flapCount) * flapAmount); for (int i = 0; i < wings.Length; i++) { wings [i].transform.localScale = scalar; } wings [0].transform.localEulerAngles = leftWingRotation; wings [1].transform.localEulerAngles = rightWingRotation; } }
void Update() { counter += Time.deltaTime; if (counter > timeBetweenSearches) { counter = 0; if (theTarget == null) { theTarget = GameObject.Find(target); } } if (theTarget != null) { DLUtility.copyPositionRotation(theTarget, transform.gameObject); } }
private List <ReportParameterPackage> GetReportParameterPackages(ReportPackage report, XElement reportDef) { var dataSets = report.ReportDataSets; var xmlns = reportDef.GetDefaultNamespace().ToString(); var reportParams = reportDef.Descendants(XName.Get("ReportParameter", xmlns)); var localReportParams = ReportViewer1.LocalReport.GetParameters(); var reportParameterPkgs = new List <ReportParameterPackage>(); foreach (var reportParam in reportParams) { var reportParamName = reportParam.SafeAttributeValue("Name", ""); // Skip internal hidden parameter "EclipseURL" (Used to link documents) if (reportParamName == Constants.REPORTS_ECLIPSE_URL) { continue; } //TODO: Use the report parameter prompt instead of the name var multiValue = reportParam.Element(XName.Get("MultiValue", xmlns)); var hasMultiValues = false; if (multiValue != null) { Boolean.TryParse(multiValue.Value, out hasMultiValues); } var allowBlank = reportParam.Element(XName.Get("AllowBlank", xmlns)); var hasAllowBlank = false; if (allowBlank != null) { Boolean.TryParse(allowBlank.Value, out hasAllowBlank); } var validValues = reportParam.Descendants(XName.Get("ValidValues", xmlns)); var paramValidValues = new List <ParameterValidValue>(); var hasValidValues = false; String lrpLabel = String.Empty; String lrpValue = String.Empty; var rpPkg = new ReportParameterPackage { Name = reportParamName }; foreach (var validValue in validValues) { hasValidValues = true; var paramValue = validValue.Descendants(XName.Get("ParameterValue", xmlns)); foreach (var param in paramValue) { var vvLabel = param.Element(XName.Get("Label", xmlns)); var vvValue = param.Element(XName.Get("Value", xmlns)); var lblVal = vvLabel == null ? null : vvLabel.Value; GetReportParameters(localReportParams, reportParamName, lblVal, out lrpLabel, out lrpValue); paramValidValues.Add(new ParameterValidValue { Name = reportParamName, Label = lrpLabel, Value = lrpValue }); } } rpPkg.ValidValues = paramValidValues.ToArray(); var defaultValues = reportParam.Descendants(XName.Get("DefaultValue", xmlns)); var paramDefaultValues = new List <String>(); foreach (var defaultValue in defaultValues) { var defParamValues = defaultValue.Descendants(XName.Get("Values", xmlns)); foreach (var defParamValue in defParamValues) { var dvValue = defParamValue.Element(XName.Get("Value", xmlns)); var val = dvValue == null ? null : dvValue.Value; GetReportParameters(localReportParams, reportParamName, val, out lrpLabel, out lrpValue); paramDefaultValues.Add(lrpValue); } } rpPkg.DefaultValues = paramDefaultValues.ToArray(); if (hasValidValues) { var dataSetRefs = reportParam.Descendants(XName.Get("DataSetReference", xmlns)); foreach (var dataSetRef in dataSetRefs) { var fieldValue = dataSetRef.Element(XName.Get("ValueField", xmlns)).Value; var fieldLabel = dataSetRef.Element(XName.Get("LabelField", xmlns)).Value; var dataSetName = dataSetRef.Element(XName.Get("DataSetName", xmlns)).Value; // Obtain the dataset from the reports data sets, matched on name int idx; var dataSetsLen = dataSets.SafeLength(); for (idx = 0; idx < dataSetsLen; idx++) { var queryParams = new Dictionary <String, String>(); if (dataSets[idx].Name == dataSetName) { var sqlQuery = DLUtility.Deserialize <SQLQuery>(dataSets[idx].QueryDefinition); if (sqlQuery.Params.Count == 0) { var args = new GetReportDataArgs { QueryDefinition = dataSets[idx].QueryDefinition }; _sb.SendTimeout = TimeSpan.FromMinutes(30); var dlSvc = _sb.DataLinkV2(); var rdSR = dlSvc.GetReportData(args); ExceptionsML.Check(rdSR.Error); var colLen = rdSR.Result.Columns[fieldLabel].SafeLength(); for (int colIdx = 0; colIdx < colLen; colIdx++) { paramValidValues.Add(new ParameterValidValue { Name = reportParamName, Label = rdSR.Result.Columns[fieldLabel][colIdx], Value = rdSR.Result.Columns[fieldValue][colIdx] ?? String.Empty }); } rpPkg.ValidValues = paramValidValues.ToArray(); } else { rpPkg.Name = reportParamName; rpPkg.ValidValues = new ParameterValidValue[0]; rpPkg.IsTypeAhead = true; rpPkg.DataSetId = dataSets[idx].Id; } } } } rpPkg.IsMultiValued = hasMultiValues; rpPkg.AllowBlank = hasAllowBlank; } else { var type = reportParam.Descendants(XName.Get("DataType", xmlns)); var values = reportParam.Descendants(XName.Get("Value", xmlns)); var vals = GetStandardReportParameters(localReportParams, reportParamName); rpPkg.Values = vals; rpPkg.Type = reportParam.Element(XName.Get("DataType", xmlns)).Value; } rpPkg.ValidValues.Sort <ParameterValidValue>((a, b) => a.Label.CompareTo(b.Label)); reportParameterPkgs.Add(rpPkg); } return(reportParameterPkgs); }