internal void anchorableDoneMoving(Anchorable anchorable) { if (((CustomStroke)anchorable).Id.ToString() == this.FirstAnchorId || ((CustomStroke)anchorable).Id.ToString() == this.SecondAncorId) { EditionSocket.EditStroke(this.toJson()); } }
public bool FindAnchorableInArc(out Anchorable anchorable) { anchorable = null; foreach (ArcRaycaster arcRaycaster in arcRaycasters) { if (arcRaycaster.FindAnchorable(out anchorable)) break; } return anchorable != null; }
public bool FindAnchorableInCircle(out Anchorable anchorable) { anchorable = null; foreach (CircleOverlapper circleOverlapper in circleOverlappers) { if (circleOverlapper.FindAnchorable(out anchorable)) break; } return anchorable != null; }
public void Release() { WhitTools.Assert(HasConnectedAnchorable(), "not connected! can't release if not connected."); springJoint.enabled = false; connectedAnchorable.HandleRelease(); connectedAnchorable = null; currentState = GrappleRopeStates.Retracted; }
public bool FindAnchorable(out Anchorable foundAnchorable) { var colliders = CircleOverlap(); if (colliders.Length == 0) { foundAnchorable = null; return false; } Collider2D collider = GetClosest(colliders); foundAnchorable = collider.GetComponent<Anchorable>(); return foundAnchorable != null; }
public void Connect(Anchorable anchorable) { WhitTools.Assert(!HasConnectedAnchorable(), "already connected to something else! release before connecting."); SetSpringJointAttributes(); springJoint.connectedBody = anchorable.rigid; springJoint.connectedAnchor = anchorable.GetAnchorPoint(); springJoint.enabled = true; connectedAnchorable = anchorable; anchorable.HandleConnected(); currentState = GrappleRopeStates.Connected; }
public bool CanDirectlyReachAnchorable(Anchorable anchorable) { Vector2 vector = anchorable.transform.position - transform.position; float distance = vector.magnitude; Vector2 direction = vector.normalized; distance -= 0.01f; var colliders = RaycastDirectionDirect(direction, distance); MountainChunk mountain = null; foreach (Collider2D collider in colliders) { mountain = collider.GetComponent<MountainChunk>(); if (mountain != null) break; } return mountain == null; }
internal void anchorableMoved(Anchorable anchorable) { bool changed = false; if (((CustomStroke)anchorable).Id.ToString() == this.FirstAnchorId) { Point newPoint = anchorable.getAnchorPointPosition(this.FirstAnchorIndex); this.StylusPoints[0] = new StylusPoint(newPoint.X, newPoint.Y); changed = true; } if (((CustomStroke)anchorable).Id.ToString() == this.SecondAncorId) { Point newPoint = anchorable.getAnchorPointPosition(this.SecondAncorIndex); this.StylusPoints[this.StylusPoints.Count - 1] = new StylusPoint(newPoint.X, newPoint.Y); changed = true; } if (changed) { this.Refresh(); } }
public bool FindAnchorableInScreenOverlap(out Anchorable anchorable) { anchorable = null; return screenOverlapper.FindAnchorable(out anchorable); }
public bool FindAnchorable(out Anchorable foundAnchorable) { foundAnchorable = ScreenOverlap(); return foundAnchorable != null; }
private void RecycleAnchorable(Anchorable anchorable) { int indexOfAnchorable = anchorables.IndexOf(anchorable); RecycleAnchorableAtIndex(indexOfAnchorable); }
private bool ShouldRecycleAnchorable(Anchorable anchorable) { return !anchorable.isConnected && ScreenUtility.instance.IsOffLeftOfScreenWithMargin(anchorable.transform.position.x); }
private bool ConnectGrapplerIfPossible(Anchorable anchorable) { if (!ReadyToConnect()) return false; if (!hasConnected) { grapplerRope.ResetAccelerationCooldown(); hasConnected = true; } Connect(anchorable); return true; }
private void Connect(Anchorable anchorable) { grapplerRope.Connect(anchorable); }