public void ShowTooltip(ChemEObject value) { for (int i = 0; i < value.Quantums.Count; i++) { Tooltip.text = Tooltip.text + value.Quantums[i].Index.ToString() + "-" + value.Quantums[i].PreviousPosition.Name + "*" + "\n"; } }
public void AddAllChemEObject(ChemEObject value) { if (!AllChemEObjects.Any(item => item.Name == value.Name)) { AllChemEObjects.Add(value); } }
public void SetGravityChemEObject(ChemEObject objToChange, int gravityOrder) { var item = AllChemEObjects.Find(x => x.Name == objToChange.Name); if (item != null) { item.GravityOrder = gravityOrder; } }
void GenerateQuantums(int Quantity, ChemEObject StartPosition) { for (int i = 1; i <= Quantity; i++) { Quantum newQuantum = new Quantum { Position = StartPosition }; AllQuantums.Add(newQuantum); StartPosition.Quantums.Add(newQuantum); } }
void AssignObject(ChemEObject value) { // Events associations value.AssociatedObject = GameObject.Find(value.Name + "/Symbol"); if (value.AssociatedObject != null) { if (value.AssociatedObject.transform.parent.gameObject.GetComponent <EventTrigger>() != null) { value.AssociatedObject.GetComponentInParent <EventTrigger>().triggers[0].callback.AddListener((eventData) => { ShowTooltip(value); }); value.AssociatedObject.transform.parent.gameObject.GetComponentInParent <EventTrigger>().triggers[1].callback.AddListener((eventData) => { HideTooltip(); }); // onClick if (value is Valve) { value.AssociatedObject.GetComponentInParent <EventTrigger>().triggers[2].callback.AddListener((eventData) => { ClickValve((Valve)value); }); } if (value is Pump) { value.AssociatedObject.GetComponentInParent <EventTrigger>().triggers[2].callback.AddListener((eventData) => { ClickPump((Pump)value); }); } } } }