Exemple #1
0
		public void AddObject(Actor actor) {
			Type cls = actor.GetType();
			if (CollectionUtils.Contains(cls,this.collisionClasses)) {
				this.collisionChecker.AddObject(actor);
			} else {
				LinkedList classSet = (LinkedList) this.freeObjects.Get(cls);
				if (classSet == null) {
					classSet = new LinkedList();
					this.freeObjects.Put(cls, classSet);
				}
				CollectionUtils.Add(classSet,actor);
			}
		}
Exemple #2
0
 private void PrepareForCollision(Actor actor, Type cls)
 {
     this.MakeCollisionObjects(actor.GetType(), false);
     this.MakeCollisionObjects(cls, true);
 }
Exemple #3
0
		private void PrepareForCollision(Actor actor, Type cls) {
			this.MakeCollisionObjects(actor.GetType(), false);
			this.MakeCollisionObjects(cls, true);
		}
Exemple #4
0
		public void UpdateObjectSize(Actor o) {
			 lock (typeof(CollisionManager)) {
						if (!this.freeObjects.ContainsKey(o.GetType())) {
							this.collisionChecker.UpdateObjectSize(o);
						}
					}
		}
Exemple #5
0
		public void UpdateObjectLocation(Actor o, float oldX, float oldY) {
			 lock (typeof(CollisionManager)) {
						if (!this.freeObjects.ContainsKey(o.GetType())) {
							this.collisionChecker.UpdateObjectLocation(o, oldX, oldY);
						}
					}
		}
Exemple #6
0
		public void RemoveObject(Actor o) {
			 lock (typeof(CollisionManager)) {
						LinkedList classSet = (LinkedList) this.freeObjects.Get(o
								.GetType());
						if (classSet != null) {
                            classSet.Remove(o);
						} else {
							this.collisionChecker.RemoveObject(o);
						}
					}
		}
Exemple #7
0
 /// <summary>
 /// 获得含有指定角色碰撞的List集合
 /// </summary>
 ///
 /// <param name="actor"></param>
 /// <returns></returns>
 public IList GetCollisionObjects(Actor actor)
 {
     if (isClose)
     {
         return null;
     }
     return GetCollisionObjects(actor.GetType());
 }