Example #1
0
        public DualDraw(DataRow data)
        {
            DataRow[] parts = data.GetChildRows("Module_Module");

            _lower = (IDrawExecuter)BaseModule.GetModule(parts[0]);
            _upper = (IDrawExecuter)BaseModule.GetModule(parts[1]);
        }
Example #2
0
 public DualDraw(IDrawExecuter lower, IDrawExecuter upper)
 {
     _lower = lower;
     _upper = upper;
 }
Example #3
0
        public override void Update(GameTime gameTime)
        {
            if ((this.MDrawModule is AnimatedDrawer) && (_prevPosition == _position) != _moving)
            {
                if(!_moving)//stop
                    switch (Face)
                    {
                        case Facing.DOWN:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("standDown");
                            break;
                        case Facing.LEFT:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("standLeft");
                            break;
                        case Facing.RIGHT:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("standRight");
                            break;
                        case Facing.UP:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("standUp");
                            break;
                    }
                else//move on
                    switch (Face)
                    {
                        case Facing.DOWN:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("walkDown");
                            break;
                        case Facing.LEFT:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("walkLeft");
                            break;
                        case Facing.RIGHT:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("walkRight");
                            break;
                        case Facing.UP:
                            (this.MDrawModule as AnimatedDrawer).SetCurrentAnimation("walkUp");
                            break;
                    }
                _moving = _prevPosition == _position;

            }

            CM.Update(gameTime);

            #region Calc tilepos

            TilePosition = new Point((int)(Position.X / Constants.TileSize), (int)(Position.Y / Constants.TileSize));

            if (_mDrawModule is AnimatedDrawer)
                ((AnimatedDrawer)_mDrawModule).Update(gameTime);

            #endregion
            if (_mInteractModule != null)
                _mInteractModule.Update(gameTime);
            if (_mThinkModule != null)
                _mThinkModule.Update(gameTime);
            if (_mDieModule != null && Health <= 0)
                _mDieModule.Die();
            if (_mDrawModule != null)
            {
                _mDrawModule.Update(gameTime);
                if (_mDrawModule is AnimatedDrawer)
                    if (((AnimatedDrawer)_mDrawModule).HasEnded)
                    {
                        this._mDrawModule = null;
                        this.ToBeRemoved = true;
                    }
            }
            if (_mDrawModule != null && _mDrawModule is ParticleSystem)
            {
                _mDrawModule.Update(gameTime);
            }
        }
Example #4
0
 internal void RemoveAllModules()
 {
     _mCollideModule = null;
     _mInteractModule = null;
     _mThinkModule = null;
     _mDieModule = null;
     _mDrawModule = null;
 }
Example #5
0
 public void AddModule(BaseModule module)
 {
     module.SetOwner(this);
     if (module is IThinkModule)
         _mThinkModule = module as IThinkModule;
     if (module is IDrawExecuter)
         _mDrawModule = module as IDrawExecuter;
     if (module is IInteractModule)
         _mInteractModule = module as IInteractModule;
     if (module is IDieModule)
         _mDieModule = module as IDieModule;
     if (module is ICollideModule)
         _mCollideModule = module as ICollideModule;
 }