Пример #1
0
 public void FillSurfaceGameObject(SGT_FillGameObject fill)
 {
     if (surfaceGameObject != null)
     {
         fill.GameObject = surfaceGameObject;
     }
 }
 public void FillSurfaceGameObject(SGT_FillGameObject fill)
 {
     if (surfaceGameObject != null)
     {
         fill.GameObject = surfaceGameObject;
     }
 }
    public void Update()
    {
        if (surfaceGameObject == null)
        {
            var fillSurfaceGameObject = new SGT_FillGameObject();

            SendMessage("FillSurfaceGameObject", fillSurfaceGameObject, SendMessageOptions.DontRequireReceiver);

            surfaceGameObject = fillSurfaceGameObject.GameObject;
        }

        if (activeCollider != null)
        {
            if (activeGameObject == null)
            {
                activeGameObject = SGT_Helper.CreateGameObject("Collider (Active)", gameObject);
            }

            activeCollider.GameObject = activeGameObject;
            activeCollider.Update();
        }
        else
        {
            if (activeGameObject != null)
            {
                SGT_Helper.DestroyGameObject(activeGameObject);
            }
        }

        if (nextCollider != null)
        {
            if (nextGameObject == null)
            {
                nextGameObject = SGT_Helper.CreateGameObject("Collider (Currently Building)", gameObject);
            }

            nextCollider.GameObject = nextGameObject;
            nextCollider.Update();
        }
        else
        {
            if (nextGameObject != null)
            {
                SGT_Helper.DestroyGameObject(nextGameObject);
            }
        }

        if (activeGameObject != null)
        {
            SGT_Helper.SetLocalScale(activeGameObject.transform, surfaceGameObject.transform.localScale);
        }
        if (nextGameObject != null)
        {
            SGT_Helper.SetLocalScale(nextGameObject.transform, surfaceGameObject.transform.localScale);
        }

#if UNITY_EDITOR == true
        if (Application.isEditor == true)
        {
            SGT_Helper.HideGameObject(activeGameObject);
            SGT_Helper.HideGameObject(nextGameObject);
        }
#endif
    }