public void Collision(ref Entity entity, ref ComponentPosition position, ref ComponentCollisionSphere coll) { if ((position.Position - camera.cameraPosition).Length < coll.Radius + camera.Radius) { collisionManager.CollisionBetweenCamera(ref entity, COLLISIONTYPE.SPHERE_SPHERE); } }
public void OnAction(Entity entity) { if ((entity.Mask & MASK) == MASK) { List <IComponent> components = entity.Components; IComponent collComponent = components.Find(delegate(IComponent component) { return(component.ComponentType == ComponentTypes.COMPONENT_COLLISION_SPHERE); }); ComponentCollisionSphere collision = (ComponentCollisionSphere)collComponent; IComponent positionComponent = components.Find(delegate(IComponent component) { return(component.ComponentType == ComponentTypes.COMPONENT_POSITION); }); ComponentPosition position = (ComponentPosition)positionComponent; Collision(ref entity, ref position, ref collision); } }