예제 #1
0
 private void HandleOutlineEffectDuringMaterialSwap(Platform p)
 {
     // The material swap eliminates the outline effect. We therefore need to set it back manually
     if (p.tag == "Rotateable")
     {
         RotateablePlatform rotPlat = ((RotateablePlatform)p);
         if (rotPlat != null && rotPlat.IsActivated)
         {
             rotPlat.outlineEffect.enabled = false;
             rotPlat.outlineEffect.enabled = true;
         }
     }
 }
예제 #2
0
    private void Update()
    {
        if (debugRaycast)
        {
            Debug.DrawRay(transform.position, raycastDistance * raycastDirection, Color.yellow);
        }

        if (Physics.Raycast(transform.position, raycastDirection, out raycastHit, raycastDistance))
        {
            // If hit, check for platform locking
            GameObject hitObject = raycastHit.collider.gameObject;
            if (hitObject.tag == "Rotateable")
            {
                Debug.Log("Hit Rotateable");
                hitObject.GetComponent <RotateablePlatform>().IsLocked = true;
            }
            else if (hitObject.transform.parent != null && hitObject.transform.parent.tag == "Rotateable")
            {
                Debug.Log("Hit Rotateable");
                hitObject.GetComponentInParent <RotateablePlatform>().IsLocked = true;
            }
            else if (hitObject.tag == "Floating")
            {
                transform.parent = hitObject.transform;
            }
        }
        else
        {
            foreach (var go in GameObject.FindGameObjectsWithTag("Rotateable"))
            {
                RotateablePlatform rotPlatform = go.GetComponent <RotateablePlatform>();
                if (rotPlatform == null)
                {
                    rotPlatform = GetComponentInParent <RotateablePlatform>();
                }
                rotPlatform.IsLocked = false;
            }

            transform.parent = null;
        }
    }