void Start() { if (AllowGameModeOverride) { gameMode = GameModeOverride; } else { gameMode = GameState.GameMode; } Debug.Log("Starting game in mode: " + gameMode); // Register callbacks FloorController.BallCollidedWithFloorEvent += OnResetTurn; BallController.ThrowTimer += OnResetTurn; BallGrabber.BallGrabbedByCell += OnResetRequestedByBoard; BoardController.GameOver += OnGameOver; if (DebugSlider) { SpeedFactor = DebugSlider.value / 10.0f; if (DebugLabel1) { DebugLabel1.text = SpeedFactor.ToString(); } DebugSlider.onValueChanged.AddListener(delegate { OnSetDebugVelocity(); }); } //OnResetTurn(); StartNewGame(); }
private void Update(EvaluationContext context) { var contextLocalTime = (float)context.LocalTime; var contextLocalFxTime = (float)context.LocalFxTime; float time = 0; switch ((Modes)Mode.GetValue(context)) { case Modes.LocalFxTimeInBars: time = contextLocalFxTime; break; case Modes.LocalTimeInBars: time = contextLocalTime; break; case Modes.PlaybackTimeInSecs: time = contextLocalTime * 240 / (float)context.Playback.Bpm; break; default: throw new ArgumentOutOfRangeException(); } TimeInBars.Value = time * SpeedFactor.GetValue(context); TimeInSecs.Value = (float)context.Playback.TimeInSecs * SpeedFactor.GetValue(context); }
public void OnSetDebugVelocity() { DebugSlider.onValueChanged.RemoveAllListeners(); if (DebugSlider != null) { SpeedFactor = DebugSlider.value / 10.0f; } if (DebugLabel1 != null) { DebugLabel1.text = SpeedFactor.ToString(); } DebugSlider.onValueChanged.AddListener(delegate { OnSetDebugVelocity(); }); }
/// <summary> /// Returns true if VehicleType instances are equal /// </summary> /// <param name="input">Instance of VehicleType to be compared</param> /// <returns>Boolean</returns> public bool Equals(VehicleType input) { if (input == null) { return(false); } return (( TypeId == input.TypeId || (TypeId != null && TypeId.Equals(input.TypeId)) ) && ( Profile == input.Profile || (Profile != null && Profile.Equals(input.Profile)) ) && ( Capacity == input.Capacity || Capacity != null && Capacity.SequenceEqual(input.Capacity) ) && ( SpeedFactor == input.SpeedFactor || (SpeedFactor != null && SpeedFactor.Equals(input.SpeedFactor)) ) && ( ServiceTimeFactor == input.ServiceTimeFactor || (ServiceTimeFactor != null && ServiceTimeFactor.Equals(input.ServiceTimeFactor)) ) && ( CostPerMeter == input.CostPerMeter || (CostPerMeter != null && CostPerMeter.Equals(input.CostPerMeter)) ) && ( CostPerSecond == input.CostPerSecond || (CostPerSecond != null && CostPerSecond.Equals(input.CostPerSecond)) ) && ( CostPerActivation == input.CostPerActivation || (CostPerActivation != null && CostPerActivation.Equals(input.CostPerActivation)) )); }
private void Update(EvaluationContext context) { var t = (float)EvaluationContext.BeatTime * SpeedFactor.GetValue(context); //var value = Value.GetValue(context); var amplitude = Amplitude.GetValue(context); var period = Period.GetValue(context); var offset = Offset.GetValue(context); var phase = Phase.GetValue(context); var amplitudeScale = AmplitudeScale.GetValue(context); Result.Value = new System.Numerics.Vector2( (float)Math.Sin(t / period.X + phase.X) * amplitude.X * amplitudeScale + offset.X, (float)Math.Sin(t / period.Y + phase.Y) * amplitude.Y * amplitudeScale + offset.Y ); }
private void Update(EvaluationContext context) { var t = OverrideTime.IsConnected ? OverrideTime.GetValue(context) : (float)context.LocalFxTime * SpeedFactor.GetValue(context); //var value = Value.GetValue(context); var amplitude = Amplitude.GetValue(context); var period = Period.GetValue(context); var offset = Offset.GetValue(context); var phase = Phase.GetValue(context); var amplitudeScale = AmplitudeScale.GetValue(context); Result.Value = new Vector3( (float)Math.Sin(t / period.X + phase.X) * amplitude.X * amplitudeScale + offset.X, (float)Math.Sin(t / period.Y + phase.Y) * amplitude.Y * amplitudeScale + offset.Y, (float)Math.Sin(t / period.Z + phase.Z) * amplitude.Z * amplitudeScale + offset.Z ); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (TypeId != null) { hashCode = hashCode * 59 + TypeId.GetHashCode(); } if (Profile != null) { hashCode = hashCode * 59 + Profile.GetHashCode(); } if (Capacity != null) { hashCode = hashCode * 59 + Capacity.GetHashCode(); } if (SpeedFactor != null) { hashCode = hashCode * 59 + SpeedFactor.GetHashCode(); } if (ServiceTimeFactor != null) { hashCode = hashCode * 59 + ServiceTimeFactor.GetHashCode(); } if (CostPerMeter != null) { hashCode = hashCode * 59 + CostPerMeter.GetHashCode(); } if (CostPerSecond != null) { hashCode = hashCode * 59 + CostPerSecond.GetHashCode(); } if (CostPerActivation != null) { hashCode = hashCode * 59 + CostPerActivation.GetHashCode(); } return(hashCode); } }
// Inspector string eats max. 5 lines - there is room for one more public override string CompInspectStringExtra() { StringBuilder stringBuilder = new StringBuilder(); // 1st line: "Temperature: xx C (Overheating/Freezing/Ideal/Safe)" or "Ruined by temperature" stringBuilder.AppendLine(StatusInfo()); // 2nd line: "Contains xx/xx ingredient (product)" if (!Empty && !Ruined) { if (Fermented) { stringBuilder.AppendLine("UF_ContainsProduct".Translate(new object[] { ingredientCount, Product.maxCapacity, Product.thingDef.label })); } else { stringBuilder.AppendLine("UF_ContainsIngredient".Translate(new object[] { ingredientCount, Product.maxCapacity, SummaryAddedIngredients })); } } // 3rd line: "Finished" or "Progress: xx %" // 4th line: "Non-ideal temp, sun, ... . Ferm. speed: xx %" if (!Empty) { if (Fermented) { stringBuilder.AppendLine("UF_Finished".Translate()); } else if (parent.Map != null) // parent.Map is null when minified { stringBuilder.AppendLine("UF_Progress".Translate(new object[] { Progress.ToStringPercent(), TimeLeft() //EstimatedTicksLeft.ToStringTicksToPeriod(true, false, true) })); if (SpeedFactor != 1f) { // Should be max. 59 chars in the English translation if (SpeedFactor < 1f) { stringBuilder.Append("UF_NonIdealInfluences".Translate(new object[] { WhatsWrong() })).Append(" ").AppendLine("UF_NonIdealSpeedFactor".Translate(new object[] { SpeedFactor.ToStringPercent() })); } else { stringBuilder.AppendLine("UF_NonIdealSpeedFactor".Translate(new object[] { SpeedFactor.ToStringPercent() })); } } } } // 5th line: "Ideal/safe temperature range" stringBuilder.AppendLine(string.Concat(new string[] { "UF_IdealSafeProductionTemperature".Translate(), ": ", Product.temperatureIdeal.min.ToStringTemperature("F0"), "~", Product.temperatureIdeal.max.ToStringTemperature("F0"), " (", Product.temperatureSafe.min.ToStringTemperature("F0"), "~", Product.temperatureSafe.max.ToStringTemperature("F0"), ")" })); return(stringBuilder.ToString().TrimEndNewlines()); }
private void Update(EvaluationContext context) { BeatTime.Value = (float)EvaluationContext.BeatTime * SpeedFactor.GetValue(context); TimeInSecs.Value = (float)EvaluationContext.GlobalTimeInSecs * SpeedFactor.GetValue(context); }