Exemplo n.º 1
0
        /// <summary>
        /// Updates all existing change list entries by the GameObjects current Property values.
        /// </summary>
        public void UpdateChanges()
        {
            if (this.changes == null || this.changes.Count == 0)
            {
                return;
            }

            // Remove empty changelist entries
            this.ClearEmptyChanges();

            // Update changelist values from properties
            for (int i = 0; i < this.changes.Count; i++)
            {
                GameObject targetObj = this.obj.ChildAtIndexPath(this.changes[i].childIndex);
                object     target;
                if (this.changes[i].componentType != null)
                {
                    target = targetObj.GetComponent(this.changes[i].componentType);
                }
                else
                {
                    target = targetObj;
                }

                VarMod modTmp = this.changes[i];
                modTmp.val      = this.changes[i].prop.GetValue(target, null);
                this.changes[i] = modTmp;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates all existing change list entries by the GameObjects current Property values.
        /// </summary>
        public void UpdateChanges()
        {
            if (this.changes == null || this.changes.Count == 0)
            {
                return;
            }

            for (int i = 0; i < this.changes.Count; i++)
            {
                GameObject targetObj = this.obj.ChildAtIndexPath(this.changes[i].childIndex);
                object     target;
                if (this.changes[i].componentType != null)
                {
                    target = targetObj.GetComponent(this.changes[i].componentType);
                }
                else
                {
                    target = targetObj;
                }

                VarMod modTmp = this.changes[i];
                modTmp.val      = this.changes[i].prop.GetValue(target, null);
                this.changes[i] = modTmp;
            }
        }
Exemplo n.º 3
0
        void ICloneExplicit.CopyDataTo(object targetObj, CloneProvider provider)
        {
            PrefabLink castObj = targetObj as PrefabLink;

            castObj.prefab  = this.prefab;
            castObj.obj     = this.obj;
            castObj.changes = null;

            if (this.changes != null)
            {
                castObj.changes = new List <VarMod>(this.changes.Count);
                for (int i = 0; i < this.changes.Count; i++)
                {
                    VarMod newVarMod = this.changes[i];
                    newVarMod.childIndex = new List <int>(newVarMod.childIndex);
                    castObj.changes.Add(newVarMod);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Updates all existing change list entries by the GameObjects current Property values.
        /// </summary>
        public void UpdateChanges()
        {
            if (this.changes == null || this.changes.Count == 0)
            {
                return;
            }

            // Remove empty changelist entries
            this.ClearEmptyChanges();

            // Update changelist values from properties
            for (int i = 0; i < this.changes.Count; i++)
            {
                GameObject targetObj = this.obj.ChildAtIndexPath(this.changes[i].childIndex);
                object     target;
                if (this.changes[i].componentType != null)
                {
                    target = targetObj.GetComponent(this.changes[i].componentType);
                }
                else
                {
                    target = targetObj;
                }

                if (target == null)
                {
                    Log.Core.WriteError("Error updating PrefabLink changes in {0}, property {1}, child index{2}:\n{3}",
                                        this.obj.FullName,
                                        this.changes[i].prop.Name,
                                        this.changes[i].childIndex,
                                        "Target object was null");
                    continue;
                }

                VarMod modTmp = this.changes[i];
                modTmp.val      = this.changes[i].prop.GetValue(target, null);
                this.changes[i] = modTmp;
            }
        }