private void CheckIntersectionAndHandleCollision(INpc npc, IBlock block) { Rectangle collisionFound = Rectangle.Intersect(npc.GetRectangle(), block.GetRectangle()); if (!collisionFound.IsEmpty) { Constants.Direction side = UtilityMethods.GetCollisionDirection(npc.GetRectangle(), block.GetRectangle(), collisionFound); handlerDictionary.GetNpcBlockHandler(npc.GetType()).HandleCollision(npc, block, side); } }
private void CheckIntersectionAndHandleCollision(IPlayer player, INpc npc) { Rectangle collisionFound = Rectangle.Intersect(player.GetRectangle(), npc.GetRectangle()); if (!collisionFound.IsEmpty) { Constants.Direction side = UtilityMethods.GetCollisionDirection(player.GetRectangle(), npc.GetRectangle(), collisionFound); handlerDictionary.GetPlayerNpcHandler(npc.GetType()).HandleCollision(player, npc, side); } }
private void ClockUpdateList(List <INpc> list) { List <int> indicesToRemove = new List <int>(); for (int i = 0; i < list.Count; i++) { INpc item = list[i]; item.ClockUpdate(); if (item.SafeToDespawn) { if (item.GetType() == typeof(Aquamentus) || item.GetType() == typeof(Skeleton) || item.GetType() == typeof(Goriya) || item.GetType() == typeof(Hand)) { itemDropper.DropItem(item.Position); } indicesToRemove.Add(i); } } for (int i = 0; i < indicesToRemove.Count; i++) { list.RemoveAt(indicesToRemove[i] - i); } }