-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e8acbe
commit 5201631
Showing
8 changed files
with
139 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using AltV.Atlas.Peds.Shared.Interfaces; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace AltV.Atlas.Peds.Shared.Factories; | ||
|
||
/// <summary> | ||
/// A factory that can be injected via DI and used to create a new ped task | ||
/// </summary> | ||
public class PedTaskFactory | ||
{ | ||
private readonly IServiceProvider _serviceProvider; | ||
/// <summary> | ||
/// The ped task factory | ||
/// </summary> | ||
/// <param name="serviceProvider">A service provider</param> | ||
public PedTaskFactory( IServiceProvider serviceProvider ) | ||
{ | ||
_serviceProvider = serviceProvider; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new ped task of the given type, with the given parameters | ||
/// </summary> | ||
/// <param name="parameters">The parameters that are required for the given ped task</param> | ||
/// <typeparam name="T">The ped task to create</typeparam> | ||
/// <returns></returns> | ||
public T CreatePedTask<T>( params object[ ] parameters ) where T : IPedTask | ||
{ | ||
return ActivatorUtilities.CreateInstance<T>( _serviceProvider, parameters ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters