void Update() { var pos1 = node1.transform.position; if( node2 == null ) { node2 = JumpNodeTrigger.FindClosestNode(pos1); if( node2 != null ) { node2.oppositeTrigger = node1; node2.node = this; } else { return; } } var pos2 = node2.transform.position; if(node2.connectToClosest) { var t1 = pos1; var t2 = pos2; t1.y = 0f; t2.y = 0f; var d = Vector3.Distance( t1, t2 ); if( d > Constants.instance.jumpNodeConnectDistance ) { node2.node = null; node2.oppositeTrigger = null; node2 = null; lineRenderer.SetVertexCount( 0 ); return; } } float distance; CalculateCurve(pos1, pos2, heightByDistance, out distance); UpdateRenderer(); }
void OnTriggerExit( Collider other ) { var jumpNode = other.GetComponent<JumpNodeTrigger>(); if( jumpNode != null && ignoreJumpNode == jumpNode ) { ignoreJumpNode = null; } }
void OnTriggerEnter( Collider other ) { var jumpNode = other.GetComponent<JumpNodeTrigger>(); if( jumpNode != null && ignoreJumpNode != jumpNode ) { jumpFunction = jumpNode.CreateJump(); ignoreJumpNode = jumpNode.oppositeTrigger; } }
void OnTriggerExit(Collider other) { var jumpNode = other.GetComponent<JumpNodeTrigger>(); if(jumpNode == ignoreJumpNode) { ignoreJumpNode = null; } else { GameObject.Find("RetroJump").GetComponent<AudioSource>().Play(); } }
void onDeath() { jumpFunction = null; ignoreJumpNode = null; }
void onDeath() { jumpFunction = null; ignoreJumpNode = null; localVelocity = Vector3.zero; }
public JumpFunction( JumpNodeTrigger start, JumpNodeTrigger destination) { this.start = start; this.destination = destination; startPos = start.transform.position; destinationPos = destination.transform.position; elapsedTime = 0f; JumpNode.CalculateCurve( startPos, destinationPos, heightByDistance, out distance ); time = distance / Constants.instance.jumpSpeed; }