public static void ApplyGamma(int tmpKelvin) { IntPtr hdc = Gamma.GetDC(IntPtr.Zero); try { Ramp ramp = new Ramp(); int rMultiplier, gMultiplier, bMultiplier; Gamma.ComputeRamp(tmpKelvin, out rMultiplier, out gMultiplier, out bMultiplier); // Fill the RGB values ramp.Red = new ushort[256]; ramp.Green = new ushort[256]; ramp.Blue = new ushort[256]; for (int i = 0; i < 256; i++) { ramp.Red[i] = (ushort)(i * 256 * rMultiplier / 255); ramp.Green[i] = (ushort)(i * 256 * gMultiplier / 255); ramp.Blue[i] = (ushort)(i * 256 * bMultiplier / 255); } Gamma.SetDeviceGammaRamp(hdc, ref ramp); } finally { Gamma.ReleaseDC(hdc, IntPtr.Zero); } }
internal void GenerateRamps(List <RampCoordinates> rampCoordinates) { foreach (RampCoordinates coords in rampCoordinates) { Vector3Int origin; Vector3Int dest; if (coords.coord1.y != coords.coord2.y) { origin = Vector3Int.zero; dest = Vector3Int.zero; if (coords.coord1.y > coords.coord2.y) { dest = coords.coord1; origin = coords.coord2; } else if (coords.coord2.y > coords.coord1.y) { dest = coords.coord2; origin = coords.coord1; } Ramp newRamp = (Instantiate(ramp).GetComponent <Ramp>()); newRamp.SetDirection(DetermineRampDirection(origin, dest)); tileGrid[origin.x][origin.z].SetRamp(newRamp); } } }
public void RegisterRamp(Ramp ramp, Entity entity, GameObject go) { var rampApi = new RampApi(ramp, entity, this); _tableApi.Ramps[ramp.Name] = rampApi; _initializables.Add(rampApi); }
void Awake() { if (instance == null) { instance = this; } fpsController = gameObject.GetComponentInParent <FirstPersonController>(); characterController = gameObject.GetComponentInParent <CharacterController>(); analogGlitch = gameObject.GetComponent <AnalogGlitch>(); digitalGlitch = gameObject.GetComponent <DigitalGlitch>(); tiltShift = gameObject.GetComponent <TiltShift>(); noiseAndGrain = gameObject.GetComponent <NoiseAndGrain>(); bloomAndFlares = gameObject.GetComponent <BloomAndFlares>(); ramp = gameObject.GetComponents <Ramp>()[1]; puffOfSmokeDetonator = puffOfSmoke.GetComponent <Detonator>(); cameraShake = gameObject.GetComponent <CameraShake>(); hudPowerText = hudPowerTextGroup.GetComponent <ShakyText>(); //Initialization digitalGlitch.intensity = .2f; analogGlitch.scanLineJitter = .414f; analogGlitch.verticalJump = .02f; analogGlitch.horizontalShake = .011f; analogGlitch.colorDrift = .11f; powerPercent = powerStartPercent; }
public static void ApplyGamma(int tmpKelvin) { IntPtr hdc = Gamma.GetDC(IntPtr.Zero); try { Ramp ramp = new Ramp(); int rMultiplier, gMultiplier, bMultiplier; Gamma.ComputeRamp(tmpKelvin, out rMultiplier, out gMultiplier, out bMultiplier); // Fill the RGB values ramp.Red = new ushort[256]; ramp.Green = new ushort[256]; ramp.Blue = new ushort[256]; for (int i = 0; i < 256; i++) { ramp.Red[i] = (ushort)(i * 256 * rMultiplier / 255); ramp.Green[i] = (ushort)(i * 256 * gMultiplier / 255); ramp.Blue[i] = (ushort)(i * 256 * bMultiplier / 255); } Gamma.SetDeviceGammaRamp(hdc, ref ramp); } finally { Gamma.ReleaseDC(hdc, IntPtr.Zero); } }
public void GeneratePath(int maxPaths = 10) { ResetProperties(); paths = new GameObject("Path"); //First Path InstantiatePath(m_StartPath, m_StartPoint); // Middle Section for (int i = 0; i < maxPaths; i++) { GameObject nextPathGameObject = InstantiatePath(RandomlyChoosePath(), NextPosition()); Path nextPath = nextPathGameObject.GetComponent <Path> (); Ramp nextRamp = nextPathGameObject.GetComponent <Ramp> (); if (nextRamp != null) { SetChosenRamp(nextRamp); nextRamp = null; } else { SetChosenPath(nextPath); } } //End Path NextPosition(); GameObject m_NextEndPath = InstantiatePath(m_EndPath, m_CurrentPoint); SetEndPath(m_NextEndPath.GetComponent <Path>()); }
private void FlipComponent() { //float zRotation = GetZRotation(attachedComponent); //attachedComponent.transform.eulerAngles += new Vector3(0f, 0f, zRotation); //Debug.Log("Flipping with RMB underway"); //Debug.Log("New eulerAngles: " + attachedComponent.transform.eulerAngles); switch (attachedComponent.transform.tag) { case "Ramp": Ramp ramp = attachedComponent.GetComponent <Ramp>(); ramp.Flip(); //if (ramp.transform.eulerAngles.z == 20f) //{ // ramp.PointRight(); //} //else if (ramp.transform.eulerAngles.z == -20f) //{ // ramp.PointLeft(); //} break; case "Bit": Bit bit = attachedComponent.GetComponent <Bit>(); bit.ToggleState(); break; } }
public NegatoscopForm() { InitializeComponent(); _currentRamp = new Ramp { Red = new ushort[256], Green = new ushort[256], Blue = new ushort[256] }; Win32Engine.GetDeviceGammaRamp(Win32Engine.GetDC(Handle), ref _currentRamp); var newRamp = new Ramp { Red = new ushort[256], Green = new ushort[256], Blue = new ushort[256] }; for (int i = 1; i < 256; i++) { newRamp.Red[i] = newRamp.Green[i] = newRamp.Blue[i] = (ushort)(Math.Min(65535, Math.Max(0, Math.Pow((i + 1) / 256.0, 44 * 0.1) * 65535 + 0.5))); } Win32Engine.SetDeviceGammaRamp(Win32Engine.GetDC(Handle), ref newRamp); }
public void OnControllerColliderHit(ControllerColliderHit hit) { if (!base.enabled) { return; } Construction componentUpRecursive = General.GetComponentUpRecursive <Construction>(hit.gameObject); if (hit.normal.y > 0.9f && componentUpRecursive != null && General.IsRoofConstruction(componentUpRecursive.m_Info.m_ID)) { componentUpRecursive.TakeDamage(new DamageInfo { m_Damager = this.m_Player.gameObject, m_Damage = 1000000f }); } Vector3 normal = hit.normal; Ramp component = hit.gameObject.GetComponent <Ramp>(); float num = 57.29578f * Mathf.Abs(Mathf.Acos(normal.y)); float num2 = (component != null) ? component.m_Angle : this.m_CharacterController.slopeLimit; if (num > num2) { float num3 = 0.3f; this.m_AdditionalSpeed.x = this.m_AdditionalSpeed.x + (1f - normal.y) * normal.x * (1f - num3); this.m_AdditionalSpeed.z = this.m_AdditionalSpeed.z + (1f - normal.y) * normal.z * (1f - num3); this.m_CollisionFlagsAddSpeed |= CollisionFlags.Sides; } else { this.m_CollisionFlagsAddSpeed |= CollisionFlags.Below; } this.m_SlideAngle = Mathf.Max(this.m_SlideAngle, num); }
private void OnCollisionEnter(Collision collision) { if (isDestroying) { return; } GroundTile tile = collision.gameObject.GetComponent <GroundTile>(); PlayerController player = collision.gameObject.GetComponent <PlayerController>(); Ramp ramp = collision.gameObject.GetComponent <Ramp>(); if (tile != null) { if (tile.HandleHit(teamAllegiance)) { Disintegrate(); } } else if (player != null && player.team == TeamUtils.GetOppositeTeam(teamAllegiance)) { if (GameManager.Instance.rules.scoreIfHitPlayer) { GameManager.Instance.IncrementScore(teamAllegiance); Disintegrate(); } } else if (ramp != null) { if (GameManager.Instance.rules.rampChangeAlliegance) { ChangeAllegiance(ramp.team); } } }
/// <summary> /// Handles the movement of a marble object /// </summary> private void MoveMarble(Pose hitPose, float snapDistance) { //find nearest ramp var nearestRamp = Ramp.FindClosestRamp(hitPose.position); if (nearestRamp == null) { lastSelectedObject.transform.position = hitPose.position; } //if within snap zone, snap to snap zone on ramp else { var nearestRampDirection = nearestRamp.transform.position - hitPose.position; float nearestRampHorizontalDistance = Mathf.Sqrt(Mathf.Pow(nearestRampDirection.x, 2) + Mathf.Pow(nearestRampDirection.z, 2)); if (nearestRampHorizontalDistance < snapDistance) { lastSelectedObject.transform.position = nearestRamp.transform.Find("SnapZone").position; lastSelectedObject.transform.rotation = nearestRamp.transform.Find("SnapZone").rotation; // Need to freeze Marble after it Snaps into place lastSelectedObject.GetComponent <Rigidbody>().Sleep(); } else { lastSelectedObject.transform.position = hitPose.position; } } }
private static void CreateRAMP(string executePath, string inputType) { const string outputExtn = ".pdf"; Ramp ramp = new Ramp(); ramp.Create(executePath, outputExtn, inputType); }
internal void SetRamp(Ramp newRamp) { ramp = newRamp; ramp.tile = this; ramp.transform.position = GetRampCoordinates(ramp.myDirection); ramp.transform.Rotate(new Vector3(0f, 90f * (int)ramp.GetDirection(), 0f)); ramp.transform.Rotate(new Vector3(0f, 0f, rampSlope)); }
public void BuildRamp(Vector3 orientation, Action onBallEnteredCb) { Ramp previous = Track[Track.Count - 1]; Ramp r = Instantiate(RampPrefab, previous.EndConnector.position, Quaternion.Euler(orientation)).GetComponent <Ramp>(); r.OnBallEnteredCb = onBallEnteredCb; Track.Add(r); }
public List <Ramp> Track; // Initialised in inspector public void BuildRamp(RampDirection direction, Action onBallEnteredCb) { Ramp previous = Track[Track.Count - 1]; Vector3 prevXYEuler = new Vector3(previous.transform.eulerAngles.x, previous.transform.eulerAngles.y, 0f); Ramp r = Instantiate(RampPrefab, previous.EndConnector.position, RampRotations[direction] * Quaternion.Euler(prevXYEuler)).GetComponent <Ramp>(); r.OnBallEnteredCb = onBallEnteredCb; Track.Add(r); }
protected void CreateArchiveSubmission(PublicationInformation projInfo, InProcess inProcess, string epub3Path) { inProcess.SetStatus("Archive"); var ramp = new Ramp { ProjInputType = projInfo.ProjectInputType }; ramp.Create(projInfo.DefaultXhtmlFileWithPath, ".zip", projInfo.ProjectInputType); inProcess.PerformStep(); }
void ChangeCurrentHeight(Ramp ramp, bool goHigher) { //Change Current Height int UpOrDown = goHigher ? 1 : -1; //Update Height int TempHeight = UpOrDown * ramp.Get_Height(); m_CurrentHeight += TempHeight; //Update Point m_CurrentPoint.y = m_CurrentHeight * RotationManager.instance.RampHeight; }
bool CheckRampDirectionFitting(Ramp ramp, bool GoHigh) { if (GoHigh) { return(RotationManager.instance.PathsMatches(m_CurrentDirection, ramp.Get_LowDirection())); } else { return(RotationManager.instance.PathsMatches(m_CurrentDirection, ramp.Get_HighDirection())); } }
public void Redraw() { this.ramps.Clear(); this.canScroll = this.canEarnPoint = this.scrollingBackground.canScroll = false; this.difficulty = 1; this.currentPoints = this.dotsCount = this.ticks = 0; // Main base ramp this.ramps.Add(new Ramp( new Vector2(0, this.game.viewport.Height - this.settings.rampThickness), new Vector2(this.game.viewport.Width, this.settings.rampThickness), this.settings.defaultScrollingSpeed )); // Side ramp this.ramps.Add(new Ramp( new Vector2(0, -this.game.viewport.Height * 0.5f), new Vector2(this.settings.rampThickness, this.game.viewport.Height * 1.5f), this.settings.defaultScrollingSpeed )); // Side ramp this.ramps.Add(new Ramp( new Vector2(this.game.viewport.Width - this.settings.rampThickness, -this.game.viewport.Height * 0.5f), new Vector2(this.settings.rampThickness, this.game.viewport.Height * 1.5f), this.settings.defaultScrollingSpeed )); this.currentRamp = this.lastRamp = this.ramps.First(); float distanceBetween = this.game.viewport.Height / this.game.settings.rampsCount; for (int i = 0; i < this.settings.rampsCount; i++) { this.ramps.Add(new Ramp( new Vector2(random.Next((int)(game.viewport.Width * 0.3f), (int)(game.viewport.Width * 0.7f)), distanceBetween * i - this.game.viewport.Width * 0.08f), new Vector2(random.Next((int)(game.viewport.Width * 0.2f), (int)(game.viewport.Width * 0.4f)), settings.rampThickness), this.settings.defaultScrollingSpeed )); } foreach (Ramp ramp in this.ramps) { ramp.SetTexture(this.settings.activeRamp); if (ramp != ramps[0] && ramp != ramps[1] && ramp != ramps[2]) { ramp.right = random.Next(2) == 1; } } this.player.Reset(this.game.settings.activeSprite); }
/// <summary> /// CullRamps iterates over the ramps list and removes any member for whom reachedEnd == true /// </summary> void CullRamps() { for (int i = ramps.Count - 1; i >= 0; i--) { GameObject ramp = ramps[i]; Ramp rampScript = ramp.GetComponent <Ramp>(); if (rampScript.ReachedEnd) { ramps.RemoveAt(i); Destroy(ramp); } } }
public static void Solve() { var N = Scanner.Scan <int>(); var Ramps = new Ramp[N]; for (var i = 0; i < N; i++) { var(x, y, p) = Scanner.Scan <long, long, long>(); Ramps[i] = new Ramp(x, y, p); } bool CanMove(Ramp from, Ramp to, long s) { return(from.P * s >= Math.Abs(from.X - to.X) + Math.Abs(from.Y - to.Y)); } const long inf = (long)4e9; var answer = inf; for (var k = 0; k < N; k++) { bool F(long s) { var queue = new Queue <Ramp>(); var used = new bool[N]; used[k] = true; queue.Enqueue(Ramps[k]); while (queue.Count > 0) { var u = queue.Dequeue(); for (var i = 0; i < N; i++) { if (!used[i] && CanMove(u, Ramps[i], s)) { used[i] = true; queue.Enqueue(Ramps[i]); } } } return(used.All(x => x)); } var s = BinarySearch(-1, inf, F); answer = Math.Min(answer, s); } Console.WriteLine(answer); }
void SetChosenRamp(Ramp ramp) { bool doGoHigher = Random.Range(0, 10) % 2 == 0; while (!CheckRampDirectionFitting(ramp, doGoHigher)) { ramp.RotatePath(); } if (doGoHigher) { //change path height ramp.ChangeRampHeight(); } //Change Current Height ChangeCurrentHeight(ramp, doGoHigher); }
public static Ramp FindClosestRamp(Vector3 pos) { Ramp result = null; float shortestDist = float.PositiveInfinity; var e = Ramp.Pool.GetEnumerator(); while (e.MoveNext()) { float currDist = (e.Current.transform.position - pos).sqrMagnitude; // float currDist = Mathf.Sqrt(Mathf.Pow(e.Current.transform.position.x-pos.x, 2) + Mathf.Pow(e.Current.transform.position.y-pos.y, 2)); if (currDist < shortestDist) { result = e.Current; shortestDist = currDist; } } return(result); }
public static ConvertedItem SetupGameObject(this Ramp ramp, GameObject obj) { var mainAuthoring = obj.AddComponent <RampAuthoring>().SetItem(ramp); var meshAuthoring = new List <IItemMeshAuthoring>(); RampColliderAuthoring colliderAuthoring = null; switch (ramp.SubComponent) { case ItemSubComponent.None: colliderAuthoring = obj.AddColliderComponent(ramp); if (ramp.IsHabitrail) { meshAuthoring.Add(ConvertedItem.CreateChild <RampWireMeshAuthoring>(obj, RampMeshGenerator.Wires)); } else { meshAuthoring.Add(ConvertedItem.CreateChild <RampFloorMeshAuthoring>(obj, RampMeshGenerator.Floor)); meshAuthoring.Add(ConvertedItem.CreateChild <RampWallMeshAuthoring>(obj, RampMeshGenerator.Wall)); } break; case ItemSubComponent.Collider: { colliderAuthoring = obj.AddColliderComponent(ramp); break; } case ItemSubComponent.Mesh: { Logger.Warn("Cannot parent a ramp mesh to a different object than a ramp!"); break; } default: throw new ArgumentOutOfRangeException(); } obj.AddComponent <ConvertToEntity>(); return(new ConvertedItem(mainAuthoring, meshAuthoring, colliderAuthoring)); }
///<inheritdoc/> public override int GetHashCode() { int hash = 17; // Overflow is fine, just wrap unchecked { hash = (hash * 29) + PaintScheme.GetHashCode(); hash = (hash * 29) + Mobility.GetHashCode(); hash = (hash * 29) + FirePower.GetHashCode(); hash = (hash * 29) + Damage.GetHashCode(); hash = (hash * 29) + Smoke.GetHashCode(); hash = (hash * 29) + TrailingEffects.GetHashCode(); hash = (hash * 29) + Hatch.GetHashCode(); hash = (hash * 29) + HeadLights.GetHashCode(); hash = (hash * 29) + TailLights.GetHashCode(); hash = (hash * 29) + BrakeLights.GetHashCode(); hash = (hash * 29) + Flaming.GetHashCode(); hash = (hash * 29) + Launcher.GetHashCode(); hash = (hash * 29) + CamouflageType.GetHashCode(); hash = (hash * 29) + Concealed.GetHashCode(); hash = (hash * 29) + FrozenStatus.GetHashCode(); hash = (hash * 29) + PowerPlantStatus.GetHashCode(); hash = (hash * 29) + State.GetHashCode(); hash = (hash * 29) + Tent.GetHashCode(); hash = (hash * 29) + Ramp.GetHashCode(); hash = (hash * 29) + BlackoutLights.GetHashCode(); hash = (hash * 29) + BlackoutBrakeLights.GetHashCode(); hash = (hash * 29) + SpotLights.GetHashCode(); hash = (hash * 29) + InteriorLights.GetHashCode(); hash = (hash * 29) + SurrenderState.GetHashCode(); hash = (hash * 29) + MaskedCloaked.GetHashCode(); } return(hash); }
private void CreateRAMP(PublicationInformation projInfo) { Ramp ramp = new Ramp(); ramp.Create(projInfo.DefaultXhtmlFileWithPath, ".jad,.jar", projInfo.ProjectInputType); }
public static extern bool SetDeviceGammaRamp(IntPtr hDC, ref Ramp lpRamp);
public void Visit(Ramp ramp) { Console.WriteLine($"Ramp-Points: {ramp.GetPoints()}"); }
public static extern bool SetDeviceGammaRamp(IntPtr hDC, ref Ramp lpRamp);
private void CreateRAMP(PublicationInformation projInfo) { Ramp ramp = new Ramp(); ramp.Create(Common.PathCombine(projInfo.DictionaryPath, Path.GetFileName(projInfo.DefaultXhtmlFileWithPath.Replace("Preserve", ""))), ".ldml", projInfo.ProjectInputType); }
internal static IVpxPrefab InstantiatePrefab(this Ramp ramp) { var prefab = UnityEngine.Resources.Load <GameObject>("Prefabs/Ramp"); return(new VpxPrefab <Ramp, RampData, RampComponent>(prefab, ramp)); }
public void Visit(Ramp ramp) { ramp.Reset(); }