public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { ResourceComponent resComp = res.transform.GetComponent <ResourceComponent>(); if (resComp != null) { if (resComp.Data.Container.MatterType.Is3DPrinterFeedstock()) { if (child == leftInputTrigger && LeftInput == null) { LeftInput = resComp; res.SnapCrate(this, child.transform.position, globalRotation: child.transform.rotation); } else if (child == rightInputTrigger && RightInput == null) { RightInput = resComp; res.SnapCrate(this, child.transform.position, globalRotation: child.transform.rotation); } } else { GuiBridge.Instance.ShowNews(NewsSource.InvalidSnap); } } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { if (res == null && child.transform.name == "PumpSnap") { string valveTag = c.tag.ToLower(); if (valveTag.EndsWith("valve")) { AttachTo(c, valveTag); } } else if (detachTimer == null && res is ResourceComponent) { if (ResourceMatchesCurrentPumpable(res as ResourceComponent)) { capturedResource = res as ResourceComponent; capturedResource.SnapCrate(this, CrateAnchor.position); if (valveType == Matter.Unspecified) { if (connectedPumpable is GasStorage && (connectedPumpable as GasStorage).Data.Container.CurrentAmount <= 0f) { this.valveType = capturedResource.Data.Container.MatterType; (connectedPumpable as GasStorage).SpecifyCompound(capturedResource.Data.Container.MatterType); this.SyncMeshesToMatterType(); } } RefreshPumpState(); } } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { if (!detachTimers.ContainsKey(res) && res != null) { if (child.name == "LeftLatch") { int index = 1; if (attachedCrates[index] != null) { index = 0; } attachedCrates[index] = res; SnapToLatch(child, res, (index * -1) + .5f); } else //if (childName == "RightLatch") { int index = 3; if (attachedCrates[index] != null) { index = 2; } attachedCrates[index] = res; SnapToLatch(child, res, (index % 2 * -1) + .5f); } } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable movesnap) { var res = c.GetComponent <ResourceComponent>(); if (res != null) { bool isOre = res.Data.Container.MatterType.IsRawMaterial(); bool isPowder = res.Data.Container.MatterType.IsFurnaceOutput(); if (isOre && capturedOre == null && child == oreSnap) { //if powder is empty or ore matches powder //and //we can make this into powder //and //not currently smelting anything or matches current smelt if ((capturedPowder == null || matches(res.Data.Container.MatterType, capturedPowder.Data.Container.MatterType)) && (res.Data.Container.MatterType.MatchingPowder() != Matter.Unspecified) && (FlexData.CurrentOre == Matter.Unspecified || res.Data.Container.MatterType == FlexData.CurrentOre)) { res.SnapCrate(this, child.transform.position); res.transform.SetParent(platform); capturedOre = res; FlexData.CurrentOre = res.Data.Container.MatterType; } else { GuiBridge.Instance.ShowNews(NewsSource.InvalidSnap); return; } } else if (isPowder && capturedPowder == null && child == powderSnap) { //if ore is empty or powder matches ore //and //we can make this powder //and //not currently smelting anything or matching ore is what we're smelting if (capturedOre == null || (capturedOre.Data.Container.MatterType == Matter.Unspecified || matches(capturedOre.Data.Container.MatterType, res.Data.Container.MatterType)) && (res.Data.Container.MatterType.MatchingOre().MatchingPowder() != Matter.Unspecified) && (FlexData.CurrentOre == Matter.Unspecified || res.Data.Container.MatterType.MatchingOre() == FlexData.CurrentOre)) { res.SnapCrate(this, child.transform.position); capturedPowder = res; FlexData.CurrentOre = res.Data.Container.MatterType.MatchingOre(); } else { GuiBridge.Instance.ShowNews(NewsSource.InvalidSnap); return; } } else { GuiBridge.Instance.ShowNews(NewsSource.InvalidSnap); return; } } }
public void DetachCrate(IMovableSnappable detaching) { var res = detaching.transform.GetComponent <ResourceComponent>(); if (res == capturedOre) { capturedOre = null; res.transform.SetParent(null); if (capturedPowder == null) { FlexData.CurrentOre = Matter.Unspecified; } } else if (res == capturedPowder) { capturedPowder = null; if (capturedOre == null) { FlexData.CurrentOre = Matter.Unspecified; } } unsnapTimer = StartCoroutine(UnsnapTimer()); }
public void DetachCrate(IMovableSnappable detaching) { if ((object)detaching == oreOut) { oreOut = null; } }
public void DetachCrate(IMovableSnappable detaching) { detachTimer = StartCoroutine(Timer()); if (detaching.transform == CurrentMinilab) { MinilabDocked = false; } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { if (c.transform == CurrentMinilab && detachTimer == null) { MinilabDocked = true; res.SnapCrate(this, MinilabSnap.position); } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable mov) { ResourceComponent res = mov as ResourceComponent; if (unsnapTimer == null && Bays.ContainsKey(child) && Bays[child] == null && res != null) { res.SnapCrate(this, child.transform.position, globalRotation: child.transform.rotation); } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider other, IMovableSnappable res) { MarketRow whichRow = GetRow(child.name); if (whichRow != null && res is ResourceComponent && !CrateInterferenceTimers.ContainsKey(whichRow)) { whichRow.Capture(this, res as ResourceComponent); } }
public void DetachCrate(IMovableSnappable detaching) { if ((object)detaching == LeftInput) { LeftInput = null; } else if ((object)detaching == RightInput) { RightInput = null; } }
public void DetachCrate(IMovableSnappable detaching) { var cube = detaching.transform.GetComponent <PowerCube>(); if (cube != null) { BalanceRemove(cube); unsnapTimer = StartCoroutine(UnsnapTimer()); } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { if (detachTimer == null && res is ResourceComponent) { if ((res as ResourceComponent).Data.Container.MatterType == Matter.Water) { capturedResource = res as ResourceComponent; capturedResource.SnapCrate(this, CrateAnchor.position); } } }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable movesnap) { if (unsnapTimer == null) { var cube = movesnap.transform.GetComponent <PowerCube>(); if (cube != null) { movesnap.SnapCrate(this, child.transform.position, globalRotation: child.transform.rotation); BalanceAddNew(cube, child.transform.GetSiblingIndex()); } } }
public void DetachCrate(IMovableSnappable detaching) { for (int i = 0; i < attachedCrates.Length; i++) { if (attachedCrates[i] == detaching) { attachedCrates[i] = null; break; } } detachTimers[detaching] = StartCoroutine(DetachTimer(detaching)); }
public void DetachCrate(IMovableSnappable detaching) { capturedResource = null; detachTimer = StartCoroutine(DetachCrateTimer()); PumpHandle.tag = "Untagged"; CurrentPumpStatus = PumpStatus.PumpOff; RefreshPumpState(); if (connectedPumpable != null) { connectedPumpable.OnAdjacentChanged(); //trigger a recalculate for the connected thing } }
public void DetachCrate(IMovableSnappable detaching) { if (outputs[0] == (object)detaching) { outputs[0] = null; detachTimer = StartCoroutine(Timer()); } else if (outputs[1] == (object)detaching) { outputs[1] = null; detachTimer = StartCoroutine(Timer()); } }
public void DetachCrate(IMovableSnappable detaching) { MarketRow wasAttachedTo = null; //we don't know which row we are detaching from! so... //we have to search them all possibly //short circuit hack = if one of them returns true, the remaining calls will not be made if (this.left.Release(detaching as ResourceComponent, out wasAttachedTo) || //this.middle.Release(detaching as ResourceComponent, out wasAttachedTo) || this.right.Release(detaching as ResourceComponent, out wasAttachedTo)) { this.CrateInterferenceTimers.Add(wasAttachedTo, StartCoroutine(CrateInterferenceCountdown(wasAttachedTo))); } }
void OnTriggerEnter(Collider other) { IMovableSnappable res = other.GetComponent <IMovableSnappable>(); bool hasMovableSnappable = res != null; if (dad != null && (hasMovableSnappable || !OnlyMovableSnappables)) { if (hasMovableSnappable && res.IsSnapped) { return; } this.dad.OnChildTriggerEnter(this, other, res); } }
public void DetachCrate(IMovableSnappable detaching) { #pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast if (detaching == snappedDrill) #pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast { snappedDrill = null; } #pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast else if (detaching == snappedCrate) #pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast { snappedCrate = null; } unsnapTimer = StartCoroutine(UnsnapTimer()); }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable moveSnap) { ResourceComponent res = c.GetComponent <ResourceComponent>(); if (res != null && detachTimer == null && res.Data.Container.MatterType == Matter.Produce) { if (outputs[0] == null) { outputs[0] = res; res.SnapCrate(this, child.transform.position); } else if (outputs[1] == null) { outputs[1] = res; res.SnapCrate(this, child.transform.position); } } }
public void DetachCrate(IMovableSnappable detaching) { foreach (var kvp in Bays) { if (kvp.Value == (object)detaching) { Bays[kvp.Key] = null; break; } } if (Data.State == FlightState.Landed && countdownCoroutine == null && Bays.Values.All(x => x == null)) { countdownCoroutine = StartCoroutine(BeginCountdown()); } unsnapTimer = StartCoroutine(detachTimer()); }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { ResourceComponent oreBucket = res.transform.GetComponent <ResourceComponent>(); if (oreBucket != null && oreOut == null && attachedDeposit != null && oreBucket.Data.Container.MatterType.IsRawMaterial() && matches(oreBucket.Data.Container.MatterType, attachedDeposit.Data.Extractable.MatterType)) { oreOut = oreBucket; if (oreBucket.Data.Container.MatterType == Matter.Unspecified) { oreBucket.Data.Container.MatterType = attachedDeposit.Data.Extractable.MatterType; } res.SnapCrate(this, child.transform.position); } }
public void DetachCrate(IMovableSnappable detaching) { capturedResource = null; detachTimer = StartCoroutine(DetachTimer()); }
private IEnumerator DetachTimer(IMovableSnappable detaching) { yield return(new WaitForSeconds(1f)); detachTimers.Remove(detaching); }
private void SnapToLatch(TriggerForwarder child, IMovableSnappable res, float offset) { res.SnapCrate(this, child.transform.position + child.transform.TransformDirection(new Vector3(0, 0, -offset)), carRigid); }
public void OnChildTriggerEnter(TriggerForwarder child, Collider c, IMovableSnappable res) { currentForwarder = child; currentlyColliding = c; currentResource = res; }