Example #1
0
    public void Attach(Rigidbody rb, Collider collider)
    {
        RbVisualProxy = rb.GetComponent <VisualProxy>();
        if (RbVisualProxy == null)
        {
            return;
        }

        if (rb.name == "KeyboardCase")
        {
            Collider[] cols = rb.GetComponentsInChildren <Collider>();
            foreach (var col in cols)
            {
                col.enabled = false;
            }
            collider.enabled = true;
        }

        Rb                    = rb;
        RbTr                  = rb.transform;
        RbLayer               = rb.gameObject.layer;
        rb.gameObject.layer   = 9;
        rb.angularDrag        = 1.0f;
        Rb.maxAngularVelocity = 0.1f;
        OriginalRotation      = RbTr.rotation;

        Proxy = GameObject.Instantiate(RbVisualProxy.Mirror, RbTr.position, RbTr.rotation);

        MeshRenderer[] mrs = RbVisualProxy.GetComponentsInChildren <MeshRenderer>();
        foreach (var mr in mrs)
        {
            mr.enabled = false;
        }

        TargetPoint = RbTr.position;
    }
Example #2
0
 /// <summary>Create a instance, wrapping the specified proxy</summary>
 public VisualNHibernateImpl(Func <IFrozenContext> lazyCtx, VisualProxy proxy)
     : base(lazyCtx) // do not pass proxy to base data object
 {
     this.Proxy = proxy;
 }