/// <summary> /// 删除所有指定的游戏类 /// </summary> /// /// <param name="clazz"></param> public void RemoveObject(Type clazz) { if (isClose) { return; } lock (objects) { IIterator it = objects.Iterator(); while (it.HasNext()) { Actor actor = (Actor)it.Next(); if (actor == null) { continue; } Type cls = actor.GetType(); if (clazz == null || clazz == cls || clazz.IsInstanceOfType(actor) || clazz.Equals(cls)) { if (this.objects.Remove(actor)) { this.collisionChecker.RemoveObject(actor); } RemoveActionEvents(actor); actor.SetLayer((ActorLayer)null); } } } }
/// <summary> /// 删除指定的角色 /// </summary> /// /// <param name="object"></param> public void RemoveObject(Actor o) { if (isClose) { return; } if (o == null) { return; } lock (objects) { if (this.objects.Remove(o)) { this.collisionChecker.RemoveObject(o); } RemoveActionEvents(o); o.SetLayer((ActorLayer)null); } }