Ejemplo n.º 1
0
    public bool UpdateProp(int scriptId)
    {
        bool ret = false;

        if (propId != -1)
        {
            if (gameObject.activeInHierarchy)
            {
                if (frame != cachedFrame)
                {
                    Internal.UpdateProp(scriptId, propId, frame);
                    cachedFrame = frame;
                    ret         = true;
                }

                //  Prop is only visible if parented to a visible anchor.
                HarmonyAnchor anchor = GetComponentInParent <HarmonyAnchor>();
                if (anchor != cachedAnchor)
                {
                    if (anchor != null)
                    {
                        //Message.Log( "Anchoring prop " + playName + " in script " + scriptId );
                        Internal.AnchorProp(scriptId, propId, anchor.playName, anchor.nodeName);
                    }
                    else
                    {
                        //Message.Log( "Unanchoring prop " + playName + " in script " + scriptId );
                        Internal.UnanchorProp(scriptId, propId);
                    }

                    cachedAnchor = anchor;
                    ret          = true;
                }
            }
            else
            {
                //  Current game object is deactivated.  Disable prop rendering.
                if (cachedAnchor != null)
                {
                    //Message.Log( "Unanchoring prop " + playName + " in script " + scriptId );
                    Internal.UnanchorProp(scriptId, propId);
                    cachedAnchor = null;
                    ret          = true;
                }
            }
        }

        return(ret);
    }