/// <summary> /// A constructor that can force an id upon an entity /// </summary> /// <param name="type">The type of the entity</param> /// <param name="forcedId">The id this entity has to use</param> protected BaseEntity(Entity_Types type, int forcedId) { entityId = forcedId; boundingRadius = 0; position = new Vector2D(); scale = new Vector2D(1, 1); entityType = type; tag = false; }
/// <summary> /// A constructor for the entity /// </summary> /// <param name="type">THe type of the entity</param> /// <param name="pos">The positino of the entity</param> /// <param name="boundRad">The bounding radius of the entity</param> protected BaseEntity(Entity_Types type, Vector2D pos, float boundRad) { entityId = nextValidId; boundingRadius = boundRad; position = pos; scale = new Vector2D(1, 1); entityType = type; tag = false; }
/// <summary> /// Sets the sprite of the entity /// </summary> /// <param name="type">What entity it is</param> private void SetMaterial(Entity_Types type) { switch (type) { case Entity_Types.WOOD: material = Material.WOOD; break; case Entity_Types.STONE: material = Material.STONE; break; } sprite = material.sprite; }
/// <summary> /// A basic constructor for the static entity /// </summary> /// <param name="type">The entity type</param> /// <param name="pos">The position of the entity</param> /// <param name="boundRad">The bounding radius of the entity</param> protected StaticEntity(Entity_Types type, Vector2D pos, int boundRad) : base(type, pos, boundRad) { }
/// <summary> /// The constructor for this entity /// </summary> /// <param name="type">The type of entity, can be found in the enumeration</param> /// <param name="pos">The position of the entity</param> /// <param name="boundRad">The bounding radius of the entity</param> /// <param name="qty">The amount of the material the entity has</param> public MaterialEntity(Entity_Types type, Vector2D pos, int boundRad, int qty) : base(type, pos, boundRad) { quantity = qty; SetMaterial(type); }
/// <summary> /// Sets the entity type /// </summary> /// <param name="newType">The new type of the entity</param> public void SetEntityType(Entity_Types newType) { entityType = newType; }