Class ResourceManager
Inheritance
ResourceManager
Implements
IPreRunGameService
Assembly: cs.temp.dll.dll
Syntax
public class ResourceManager : MonoBehaviour, IResourceManager, IPreRunGameService
Properties
AllResources
Declaration
public IEnumerable<IResource> AllResources { get; }
Property Value
FactionResources
Declaration
public IReadOnlyDictionary<int, IFactionSlotResourceManager> FactionResources { get; }
Property Value
gameMgr
Declaration
protected IGameManager gameMgr { get; }
Property Value
Type |
Description |
IGameManager |
|
globalEvent
Declaration
protected IGlobalEventPublisher globalEvent { get; }
Property Value
Type |
Description |
IGlobalEventPublisher |
|
Declaration
protected IInputManager inputMgr { get; }
Property Value
Type |
Description |
IInputManager |
|
logger
Declaration
protected IGameLoggingService logger { get; }
Property Value
Type |
Description |
IGameLoggingService |
|
MapResourceTypes
Declaration
public IReadOnlyList<ResourceTypeInfo> MapResourceTypes { get; }
Property Value
Methods
CreateResource(IResource, Vector3, Quaternion, InitResourceParameters)
Declaration
public ErrorMessage CreateResource(IResource resourcePrefab, Vector3 spawnPosition, Quaternion spawnRotation, InitResourceParameters initParams)
Parameters
Type |
Name |
Description |
IResource |
resourcePrefab |
|
Vector3 |
spawnPosition |
|
Quaternion |
spawnRotation |
|
InitResourceParameters |
initParams |
|
Returns
CreateResourceLocal(IResource, Vector3, Quaternion, InitResourceParameters)
Declaration
public IResource CreateResourceLocal(IResource resourcePrefab, Vector3 spawnPosition, Quaternion spawnRotation, InitResourceParameters initParams)
Parameters
Type |
Name |
Description |
IResource |
resourcePrefab |
|
Vector3 |
spawnPosition |
|
Quaternion |
spawnRotation |
|
InitResourceParameters |
initParams |
|
Returns
Type |
Description |
IResource |
|
Declaration
public bool HasResources(ResourceInput resourceInput, int factionID)
Parameters
Returns
Declaration
public bool HasResources(IEnumerable<ResourceInput> inputResources, int factionID)
Parameters
Returns
Declaration
public bool HasResources(IEnumerable<ResourceInputRange> resourceInputArray, int factionID)
Parameters
Returns
HasResourceTypeReachedLimitCapacity(ResourceTypeInfo, Int32)
Declaration
public bool HasResourceTypeReachedLimitCapacity(ResourceTypeInfo resourceType, int factionID)
Parameters
Returns
Init(IGameManager)
Declaration
public void Init(IGameManager gameMgr)
Parameters
Type |
Name |
Description |
IGameManager |
gameMgr |
|
Declaration
public bool IsResourceTypeValidInGame(ResourceInput resourceInput, int factionID)
Parameters
Returns
IsResourceTypeValidInGame(ResourceTypeInfo)
Declaration
public bool IsResourceTypeValidInGame(ResourceTypeInfo resourceType)
Parameters
Returns
IsResourceTypeValidInGame(ResourceTypeInfo, Int32)
Declaration
public bool IsResourceTypeValidInGame(ResourceTypeInfo resourceType, int factionID)
Parameters
Returns
Declaration
public void ReleaseResources(IEnumerable<ResourceInput> inputResources, int factionID)
Parameters
Declaration
public void SetReserveResources(ResourceInput resourceInput, int factionID)
Parameters
Declaration
public void SetReserveResources(IEnumerable<ResourceInput> inputResources, int factionID)
Parameters
Declaration
public void SetResource(int factionID, ResourceInput resourceInput)
Parameters
Declaration
public void SetResource(int factionID, IEnumerable<ResourceInput> resourceInputArray)
Parameters
TryGetResourceTypeWithKey(String, out ResourceTypeInfo)
Declaration
public bool TryGetResourceTypeWithKey(string key, out ResourceTypeInfo resourceType)
Parameters
Returns
Declaration
public void UpdateReserveResources(ResourceInput resourceInput, int factionID)
Parameters
Declaration
public void UpdateReserveResources(IEnumerable<ResourceInput> inputResources, int factionID)
Parameters
Adds/removes an amount of a faction's resource. If the resource type capacity is a limited based capacity resource and there is a rest amount that can not be added due to reaching maximum capacity, it will not be reported by this method.
Declaration
public void UpdateResource(int factionID, ResourceInput resourceInput, bool add)
Parameters
Type |
Name |
Description |
Int32 |
factionID |
ID of the faction whose resources will be updated.
|
ResourceInput |
resourceInput |
Defines the resource type and amount to add/remove.
|
Boolean |
add |
Adds the resources when true, otherwise removes the resources from the faction.
|
Adds/removes an amount of a faction's resource.
Declaration
public void UpdateResource(int factionID, ResourceInput resourceInput, bool add, out int restAmount)
Parameters
Type |
Name |
Description |
Int32 |
factionID |
ID of the faction whose resources will be updated.
|
ResourceInput |
resourceInput |
Defines the resource type and amount to add/remove.
|
Boolean |
add |
Adds the resources when true, otherwise removes the resources from the faction.
|
Int32 |
restAmount |
In case of a capacity type resource with limit based capacity, this returns the amount that can not be added due to reaching maximum capacity, if that maximum capacity is ever reached.
|
Adds/removes an amount of a faction's resource. If the one of the resource types has a limited based capacity resource and there is a rest amount that can not be added due to reaching maximum capacity, it will not be reported by this method.
Declaration
public void UpdateResource(int factionID, IEnumerable<ResourceInput> resourceInputArray, bool add)
Parameters
Type |
Name |
Description |
Int32 |
factionID |
ID of the faction whose resources will be updated.
|
IEnumerable<ResourceInput> |
resourceInputArray |
Array where each element defines a resource type and the amount to add/remove.
|
Boolean |
add |
Adds the resources when true, otherwise removes the resources from the faction.
|
Implements
IPreRunGameService