//test for collision against a specific object private Actor CheckCollisionWithActor(GameTime gameTime, Actor3D actor3D) { //dont test for collision against yourself - remember the player is in the object manager list too! if (this != actor3D) { if (actor3D is CollidablePrimitiveObject) { CollidablePrimitiveObject collidableObject = actor3D as CollidablePrimitiveObject; if (this.CollisionPrimitive.Intersects(collidableObject.CollisionPrimitive, this.Transform.TranslateIncrement)) { return(collidableObject); } } else if (actor3D is SimpleZoneObject) { SimpleZoneObject zoneObject = actor3D as SimpleZoneObject; if (this.CollisionPrimitive.Intersects(zoneObject.CollisionPrimitive, this.Transform.TranslateIncrement)) { return(zoneObject); } } } return(null); }
public override object GetDeepCopy() { SimpleZoneObject actor = new SimpleZoneObject("clone - " + ID, //deep this.ActorType, //deep (Transform3D)this.Transform.Clone(), //deep this.StatusType, //deep (ICollisionPrimitive)this.CollisionPrimitive.Clone()); //deep if (this.ControllerList != null) { //clone each of the (behavioural) controllers foreach (IController controller in this.ControllerList) { actor.AttachController((IController)controller.Clone()); } } return(actor); }