Exemple #1
0
 public void StartDraw(Hero hero)
 {
     for (int i = 0, len = DecorPool.Length; i < len; i++)
     {
         if (!DecorPool[i].Visible || DecorPool[i].HitRect.Y > hero.HitRect.Y)
         {
             _stoppingPoint = i;
             break;
         }
         DecorPool[i].Draw();
     }
 }
Exemple #2
0
 public CharacterManager()
 {
     _myHero = new Hero();
 }
Exemple #3
0
 internal void Loot(Hero hero)
 {
     if (_gotoHero == null)
         _gotoHero = hero;
 }
Exemple #4
0
        internal bool Update()
        {
            _lifetime = Lifetime + PlayScreen.OfficialGametime.ElapsedGameTime.Milliseconds;
            if (_forceQuit || InInventory)
            {
                _active = false;
                return false;
            }

            if (_active)
            {
                if (_gotoHero != null)
                {
                    if (HitRect.Intersects(_gotoHero.HitRect))
                    {
                        Pickup();
                        _active = false;
                        _gotoHero = null;
                        return false;
                    }

                    if (_speedSet < 10)
                    {
                        var diffx = _gotoHero.HitRect.X - HitRect.X;
                        var diffy = _gotoHero.HitRect.Y - HitRect.Y;
                        _gotoVector.X = diffx/SpeedToCharacter;
                        _gotoVector.Y = diffy/SpeedToCharacter;
                        _gotoVector.X += _gotoVector.X < 0 ? -1.4f : 1.4f;
                        _gotoVector.Y += _gotoVector.Y < 0 ? -1.4f : 1.4f;
                        _speedSet = 0;
                    }
                    _speedSet++;
                }
                else
                    _gotoVector.X = _gotoVector.Y = 0;

                _tween.Update(ref _gotoVector, ref _hitRect);
                return true;
            }

            return false;
        }
Exemple #5
0
 public void PutOnGround(float positionX, float positionY)
 {
     _active = true;
     _hitRect.X = (int) positionX;
     _hitRect.Y = (int) positionY;
     _tween.UpdatePositions(positionX, positionY);
     InventoryPosition = 0;
     InInventory = false;
     _forceQuit = false;
     _gotoHero = null;
     _speedSet = 0;
     _lifetime = 0;
 }