示例#1
0
        //Мы предполагаем, что компонент Transform есть всегда
        public JediumGameObject(IGameObject actor, JediumTransformSnapshot transform, List <JediumBehaviourSnapshot> behaviours)
        {
            Actor = actor;

            _behaviours = new Dictionary <TYPEBEHAVIOUR, JediumBehaviour>();
            //  this._transform = new JediumTransform(this,transform);



            _behaviours.Add(TYPEBEHAVIOUR.TRANSFORM, new JediumTransform(this, transform));

            // _animator = null;
            // _touchable = null;

            foreach (var beh in behaviours)
            {
                if (beh is JediumToucheableSnapshot)
                {
                    JediumToucheableSnapshot s_touchable = beh as JediumToucheableSnapshot;
                    JediumTouchable          _touchable  = new JediumTouchable(this);
                    _touchable.FromSnapshot(s_touchable);
                    _behaviours.Add(TYPEBEHAVIOUR.TOUCH, _touchable);
                }

                if (beh is JediumAnimatorSnapshot)
                {
                    JediumAnimatorSnapshot s_animator = beh as JediumAnimatorSnapshot;
                    JediumAnimator         _animator  = new JediumAnimator(this);
                    _animator.FromSnapshot(s_animator);

                    _behaviours.Add(TYPEBEHAVIOUR.ANIMATION, _animator);
                }
            }
        }
示例#2
0
        public override void FromSnapshot(JediumBehaviourSnapshot snap)
        {
            if (snap.GetType() != typeof(JediumTransformSnapshot))
            {
                //warn
                return;
            }

            JediumTransformSnapshot tsnap = (JediumTransformSnapshot)snap;

            _posX   = tsnap.X;
            _posY   = tsnap.Y;
            _posZ   = tsnap.Z;
            _quatX  = tsnap.RotX;
            _quatY  = tsnap.RotY;
            _quatZ  = tsnap.RotZ;
            _quatW  = tsnap.RotW;
            _scaleX = tsnap.ScaleX;
            _scaleY = tsnap.ScaleY;
            _scaleZ = tsnap.ScaleZ;
        }
示例#3
0
 public JediumTransform(JediumGameObject parent, JediumTransformSnapshot snap) : base(parent)
 {
     this.FromSnapshot(snap);
 }