Exemplo n.º 1
0
 internal void anchorableDoneMoving(Anchorable anchorable)
 {
     if (((CustomStroke)anchorable).Id.ToString() == this.FirstAnchorId || ((CustomStroke)anchorable).Id.ToString() == this.SecondAncorId)
     {
         EditionSocket.EditStroke(this.toJson());
     }
 }
Exemplo n.º 2
0
	public bool FindAnchorableInArc(out Anchorable anchorable) {
		anchorable = null;
		foreach (ArcRaycaster arcRaycaster in arcRaycasters) {
			if (arcRaycaster.FindAnchorable(out anchorable)) break;
		}

		return anchorable != null;
	}
Exemplo n.º 3
0
	public bool FindAnchorableInCircle(out Anchorable anchorable) {
		anchorable = null;
		foreach (CircleOverlapper circleOverlapper in circleOverlappers) {
			if (circleOverlapper.FindAnchorable(out anchorable)) break;
		}
		
		return anchorable != null;
	}
Exemplo n.º 4
0
	public void Release() {
		WhitTools.Assert(HasConnectedAnchorable(), "not connected! can't release if not connected.");

		springJoint.enabled = false;
		connectedAnchorable.HandleRelease();
		connectedAnchorable = null;
		currentState = GrappleRopeStates.Retracted;
	}
Exemplo n.º 5
0
	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;
	}
Exemplo n.º 6
0
	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;
	}
Exemplo n.º 7
0
	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;
	}
Exemplo n.º 8
0
        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();
            }
        }
Exemplo n.º 9
0
	public bool FindAnchorableInScreenOverlap(out Anchorable anchorable) {
		anchorable = null;
		return screenOverlapper.FindAnchorable(out anchorable);
	}
Exemplo n.º 10
0
	public bool FindAnchorable(out Anchorable foundAnchorable) {
		foundAnchorable = ScreenOverlap();
		return foundAnchorable != null;
	}
Exemplo n.º 11
0
	private void RecycleAnchorable(Anchorable anchorable) {
		int indexOfAnchorable = anchorables.IndexOf(anchorable);
		RecycleAnchorableAtIndex(indexOfAnchorable);
	}
Exemplo n.º 12
0
	private bool ShouldRecycleAnchorable(Anchorable anchorable) {
		return !anchorable.isConnected && ScreenUtility.instance.IsOffLeftOfScreenWithMargin(anchorable.transform.position.x);
	}
Exemplo n.º 13
0
	private bool ConnectGrapplerIfPossible(Anchorable anchorable) {
		if (!ReadyToConnect()) return false;

		if (!hasConnected) {
			grapplerRope.ResetAccelerationCooldown();
			hasConnected = true;
		}

		Connect(anchorable);

		return true;
	}
Exemplo n.º 14
0
	private void Connect(Anchorable anchorable) {
		grapplerRope.Connect(anchorable);
	}