void OnTriggerEnter(Collider other) { var iceDrill = other.GetComponent <IceDrill>(); if (iceDrill != null && Data.Extractable.MatterType == Matter.Water && unsnapTimer == null) { iceDrill.SnapCrate(this, this.transform.TransformPoint(Vector3.up * VerticalDrillOffset)); snappedDrill = iceDrill; } else { var res = other.GetComponent <ResourceComponent>(); if (res != null && unsnapTimer == null) { if (res.Data.Container.MatterType == Matter.Unspecified) { res.Data.Container.MatterType = this.Data.Extractable.MatterType; res.RefreshLabel(); } if (res.Data.Container.MatterType == this.Data.Extractable.MatterType) { res.SnapCrate(this, this.cratePosition); snappedCrate = 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()); }