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(); } }
public CharacterManager() { _myHero = new Hero(); }
internal void Loot(Hero hero) { if (_gotoHero == null) _gotoHero = hero; }
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; }
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; }