public override void FindOutputs(Solver solver) { if (string.IsNullOrEmpty(outputASelector.name) || string.IsNullOrEmpty(outputBSelector.name)) { return; } PowertrainComponent oa = solver.GetComponent(outputASelector.name); if (oa == null) { Debug.LogError($"Unknown component '{outputASelector.name}'"); return; } outputA = oa; PowertrainComponent ob = solver.GetComponent(outputBSelector.name); if (ob == null) { Debug.LogError($"Unknown component '{outputBSelector.name}'"); return; } outputB = ob; }
public void SetOutput(PowertrainComponent outputComponent) { if (string.IsNullOrEmpty(outputComponent.name)) { Debug.LogWarning("Trying to set powertrain component output to a nameless component. " + "Output will be set to [none]"); } SetOutput(outputComponent.name); }
/// <summary> /// Retrieves and sets output powertrain components. /// </summary> /// <param name="solver"></param> public virtual void FindOutputs(Solver solver) { if (string.IsNullOrEmpty(outputASelector.name)) { return; } PowertrainComponent output = solver.GetComponent(outputASelector.name); if (output == null) { Debug.LogError($"Unknown component '{outputASelector.name}'"); return; } outputA = output; }
/// <summary> /// Finds which powertrain component has its output set to this component. /// </summary> public virtual void FindInput(Solver solver) { List <PowertrainComponent> outputs = new List <PowertrainComponent>(); foreach (PowertrainComponent component in solver.Components) { component.GetAllOutputs(ref outputs); foreach (PowertrainComponent output in outputs) { if (output != null && output == this) { input = component; _inputIsNull = false; return; } } } input = null; _inputIsNull = true; }
public void RemoveComponent(PowertrainComponent i) { _components.Remove(i); }
public void AddComponent(PowertrainComponent i) { _components.Add(i); }
public DifferentialComponent(string name, PowertrainComponent outputA, PowertrainComponent outputB) { this.name = name; this.outputA = outputA; this.outputB = outputB; }