Example #1
0
    private void FindConnectedPlatform()
    {
        Ray        ray = new Ray(pointOne.position, -transform.forward);;
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            if (hit.collider.tag.Equals("Node"))
            {
                movingPlatform      = hit.transform.parent.GetComponent <MovingPlatformHandler>();
                movingPlatform.path = this;
                positionIndex       = 0;
                return;
            }
        }

        Ray rayTwo = new Ray(pointTwo.position, -transform.forward);

        if (Physics.Raycast(rayTwo, out hit, Mathf.Infinity))
        {
            if (hit.collider.tag.Equals("Node"))
            {
                movingPlatform      = hit.transform.parent.GetComponent <MovingPlatformHandler>();
                movingPlatform.path = this;
                positionIndex       = 1;
                return;
            }
        }
    }
Example #2
0
 public void DisconnectPlatform()
 {
     movingPlatform = null;
     Debug.Log("removed platform");
 }