Esempio n. 1
0
        protected override void OnCopyTo(Component target, Duality.Cloning.CloneProvider provider)
        {
            base.OnCopyTo(target, provider);
            Transform t = target as Transform;

            t.deriveAngle  = this.deriveAngle;
            t.ignoreParent = this.ignoreParent;

            t.pos   = this.pos;
            t.angle = this.angle;
            t.scale = this.scale;

            t.posAbs   = this.posAbs;
            t.angleAbs = this.angleAbs;
            t.scaleAbs = this.scaleAbs;

            t.tempVel         = this.tempVel;
            t.tempVelAbs      = this.tempVelAbs;
            t.tempAngleVel    = this.tempAngleVel;
            t.tempAngleVelAbs = this.tempAngleVelAbs;

            t.velAbs      = this.velAbs;
            t.vel         = this.vel;
            t.angleVel    = this.angleVel;
            t.angleVelAbs = this.angleVelAbs;

            // Update absolute transformation.
            // Need to update parent transform, because this may happen
            // during Prefab.Apply, which occurs before OnLoaded.
            t.parentTransform = (t.gameobj != null && t.gameobj.Parent != null) ? t.gameobj.Parent.Transform : null;
            t.UpdateAbs();
        }
Esempio n. 2
0
        private void UpdateAbsChild(bool updateTempVel = false)
        {
            this.CheckValidTransform();

            if (this.gameobj != null)
            {
                foreach (GameObject obj in this.gameobj.Children)
                {
                    Transform t = obj.Transform;
                    if (t == null)
                    {
                        continue;
                    }
                    if (!t.ignoreParent)
                    {
                        t.UpdateAbs(updateTempVel);

                        t.changes |= this.changes;
                        if ((this.changes & DirtyFlags.Scale) != DirtyFlags.None || (this.changes & DirtyFlags.Angle) != DirtyFlags.None)
                        {
                            t.changes |= DirtyFlags.Pos;
                        }
                    }
                    else
                    {
                        t.UpdateRel(updateTempVel);
                    }
                }
            }

            this.CheckValidTransform();
        }
Esempio n. 3
0
        protected override void OnCopyTo(Component target, Duality.Cloning.CloneProvider provider)
        {
            base.OnCopyTo(target, provider);
            Transform t = target as Transform;

            t.deriveAngle  = this.deriveAngle;
            t.ignoreParent = this.ignoreParent;

            t.pos   = this.pos;
            t.angle = this.angle;
            t.scale = this.scale;

            t.posAbs   = this.posAbs;
            t.angleAbs = this.angleAbs;
            t.scaleAbs = this.scaleAbs;

            t.tempVel         = this.tempVel;
            t.tempVelAbs      = this.tempVelAbs;
            t.tempAngleVel    = this.tempAngleVel;
            t.tempAngleVelAbs = this.tempAngleVelAbs;

            t.velAbs      = this.velAbs;
            t.vel         = this.vel;
            t.angleVel    = this.angleVel;
            t.angleVelAbs = this.angleVelAbs;

            t.UpdateAbs();
        }
Esempio n. 4
0
        protected override void OnCopyDataTo(object targetObj, ICloneOperation operation)
        {
            base.OnCopyDataTo(targetObj, operation);
            Transform target = targetObj as Transform;

            target.ignoreParent = this.ignoreParent;

            target.pos   = this.pos;
            target.angle = this.angle;
            target.scale = this.scale;

            target.posAbs         = this.posAbs;
            target.angleAbs       = this.angleAbs;
            target.scaleAbs       = this.scaleAbs;
            target.rotationDirAbs = this.rotationDirAbs;

            // Update absolute transformation data, because the target is relative to a different parent.
            target.UpdateAbs();
        }
Esempio n. 5
0
        protected override void OnCopyDataTo(object targetObj, ICloneOperation operation)
        {
            base.OnCopyDataTo(targetObj, operation);
            Transform target = targetObj as Transform;

            target.deriveAngle  = this.deriveAngle;
            target.ignoreParent = this.ignoreParent;

            target.pos   = this.pos;
            target.angle = this.angle;
            target.scale = this.scale;

            target.posAbs         = this.posAbs;
            target.angleAbs       = this.angleAbs;
            target.scaleAbs       = this.scaleAbs;
            target.rotationDirAbs = this.rotationDirAbs;

            target.tempVel         = this.tempVel;
            target.tempVelAbs      = this.tempVelAbs;
            target.tempAngleVel    = this.tempAngleVel;
            target.tempAngleVelAbs = this.tempAngleVelAbs;

            target.velAbs      = this.velAbs;
            target.vel         = this.vel;
            target.angleVel    = this.angleVel;
            target.angleVelAbs = this.angleVelAbs;

            // Initialize parentTransform, because it's required for UpdateAbs but is null until OnLoaded, which will be called after applying prefabs.
            if (target.gameobj != null && target.gameobj.Parent != null)
            {
                target.parentTransform = target.gameobj.Parent.Transform;
            }

            // Handle parentTransform manually to prevent null-overwrites
            operation.HandleObject(this.parentTransform, ref target.parentTransform, true);

            // Update absolute transformation data, because the target is relative to a different parent.
            target.UpdateAbs();
        }
Esempio n. 6
0
        private void UpdateAbsChild()
        {
            this.CheckValidTransform();

            if (this.gameobj != null)
            {
                foreach (GameObject obj in this.gameobj.Children)
                {
                    Transform transform = obj.Transform;
                    if (transform == null)
                    {
                        continue;
                    }
                    if (transform.ignoreParent)
                    {
                        continue;
                    }

                    transform.UpdateAbs();
                }
            }

            this.CheckValidTransform();
        }