示例#1
0
        /// <summary>
        /// Moves an entity between maps.
        /// </summary>
        /// <param name="entity">The entity changing maps.</param>
        /// <param name="oldmapid">The old map's ID.</param>
        /// <param name="newmapid">The new map's ID.</param>
        public virtual void ChangeMaps(Entity entity, string oldmapid, string newmapid)
        {
            Map oldmap = GetMap(oldmapid);
            Map newmap = GetMap(newmapid);

            oldmap.Entities.RemoveEntity(entity.ID);
            newmap.Entities.AddEntity(entity);

            if (!oldmap.IsPersistent())
            {
                RemoveMap(oldmapid);
            }

            if (entity.IsPlayer())
            {
                //TRANSITION STUFF
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Component"/> class.
 /// </summary>
 /// <param name="owner">The entity who owns the component.</param>
 public Component(Entity owner)
 {
     Owner = owner;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Logic"/> class.
 /// </summary>
 /// <param name="owner">The entity who owns the component.</param>
 public Logic(Entity owner)
 {
     Owner = owner;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EntitySnapCamera"/> class.
 /// </summary>
 /// <param name="screenresolution">The screenresolution.</param>
 /// <param name="mapsize">The mapsize.</param>
 /// <param name="drawborder">The drawborder.</param>
 /// <param name="target">The target.</param>
 public EntitySnapCamera(Vector screenresolution, Vector mapsize, Vector drawborder, Entity target)
     : base(screenresolution, mapsize, drawborder)
 {
     Target = target;
     Position = Target.Position;
 }
示例#5
0
 /// <summary>
 /// Gets the target position.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns></returns>
 public virtual Vector GetTargetPosition(Entity entity)
 {
     return TargetPosition + (entity.Position - new Vector(Hitbox.X, Hitbox.Y));
 }
示例#6
0
 /// <summary>
 /// Returns whether or not an entity is in a door.
 /// </summary>
 /// <param name="entity">The entity to check.</param>
 /// <returns></returns>
 public virtual bool EntityInDoor(Entity entity)
 {
     return Hitbox.Intersects(entity.Hitbox);
 }