Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
        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);
            }
        }