public void PrintAtTargetInvocationList() { if (AtDestination != null) { Debug.LogWarning("Invocation count movement: " + AtDestination.GetInvocationList().Length); } }
public int GetTargetInvocationCount() { if (AtDestination != null) { return(AtDestination.GetInvocationList().Length); } return(-1); }
private void Update() { if (hasTarget && path != null) { //Moving between nodes if (hasTarget && !interruptPath) { transform.position = Vector2.MoveTowards(transform.position, path[pathIndex].GetFloatPosition(), walkSpeed); } //At a node if (hasTarget && !interruptPath && (Vector2.Distance(transform.position, path[pathIndex].GetFloatPosition()) < 0.001f + targetOffsetDistance)) { pathIndex++; if (pathIndex >= path.Count) {//At final node hasTarget = false; targetOffsetDistance = 0; if (AtDestination != null) { //PrintAtTargetInvocationList(); AtDestination.Invoke(this, new EventArgs()); } } GetComponent <Vision>().Scan(); } if (hasTarget) { InfoBox.pathLength = path.Count; InfoBox.playerTile = transform.position.ToString(); InfoBox.targetTile = path[pathIndex].position.ToString(); InfoBox.stepsLeft = path.Count - pathIndex; } } TemporaryWalkOnMouseClick(); }