Пример #1
0
    void Update()
    {
        // Destroy HealthBar is Enemy Dies
        if (enemyTarget == null)
        {
            print("My target died! I will destroy myself now");
            Destroy(healthBarContainer);
        }


        // Update HealthBar Canvas Rendering
        if (enemyTarget)
        {
            // Update HealthBar Position
            healthBarContainer.transform.position = Camera.main.WorldToScreenPoint(enemyTarget.position + offset);
            if (rend.IsVisibleFrom(Camera.main) && BaneRays.ViewNotObstructed(viewPoint, UITarget, false))
            {
                HealthBarSwitch(true);
            }
            else if (!rend.IsVisibleFrom(Camera.main) || !BaneRays.ViewNotObstructed(viewPoint, UITarget, false))
            {
                HealthBarSwitch(false);
            }
        }
    }
Пример #2
0
    void Update()
    {
        //Is the render visible to the camera? If so, set it to active in the scene, else deactivate it
        rayOrigin.SetActive(GetComponent <Renderer>().IsVisibleFrom(Camera.main) ? true : false);

        //Rotates the lens rays to the camera to mimic the light bouncing inside the abnormal lens
        rayOrigin.transform.localRotation = Camera.main.transform.localRotation;

        myChild.SetActive(BaneRays.VewNotObstructed(objectBounds, transform, target.transform, true) ? true : false);
    }
Пример #3
0
 void Update()
 {
     myChild.SetActive(BaneRays.VewNotObstructed(objectBounds, transform, target, true) ? true : false);
 }