GameConditionList Count() Methods

v4.0

GameCondition has additional Count() methods.

public int CountPeriodic(string uid = null) // Conditions w/ periodic effects
public int CountInfinite(string uid = null) // Conditions which do not expire
public int CountStack(string uid = null) // Conditions which stack when new ones of the same are added
public int CountStackDistinct(string uid = null) // Number of different conditions which stack
public int CountLevel(int level, string uid = null) // Number of conditions of this level
public int CountLevelGreaterThan(int level, string uid = null) // Number greater than this level
public int CountLevelLessThan(int level, string uid = null) // Number less than this level
public int CountHasExpirationCondition(string uid = null) // Number which have a expiration condition

// These deal with real-world seconds, rather than in-game time
public int CountExpiringBeforeRealTime(float timeToAdd, string uid = null) // number expiring before now + an amount of real-world seconds
public int CountExpiringAfterRealTime(float timeToAdd, string uid = null) // number expiring after now + an amount of real-world seconds

// These utilize the TimeSpan class to specify number of in-game time
public int CountExpiringBefore(float seconds = 0f, float minutes = 0f, float hours = 0f, float days = 0f,
            float weeks = 0f, float months = 0f, float seasons = 0f, float years = 0f, string uid = null)
public int CountExpiringAfter(float seconds = 0f, float minutes = 0f, float hours = 0f, float days = 0f,
            float weeks = 0f, float months = 0f, float seasons = 0f, float years = 0f, string uid = null)
public int CountExpiringBefore(TimeSpan timeSpan, string uid = null)
public int CountExpiringAfter(TimeSpan timeSpan, string uid = null)

Examples

// NOTE: Each of these also accepts an optional uid, which will return values 
// only for conditions which match that uid.

// Count the number based on basic condition metrics
Debug.Log($"There are {gameConditionList.CountPeriodic()} periodic conditions");
Debug.Log($"There are {gameConditionList.CountInfinite()} infinite conditions");
Debug.Log($"There are {gameConditionList.CountStack()} conditions which stack");
Debug.Log($"There are {gameConditionList.CountStackDistinct()} discinct conditions which stack");
Debug.Log($"There are {gameConditionList.CountLevel(level)} level {level} conditions");
Debug.Log($"There are {gameConditionList.CountLevelGreaterThan(level)} conditions greater than level {level}");
Debug.Log($"There are {gameConditionList.CountLevelLessThan(level)} conditions less than level {level}");
Debug.Log($"There are {gameConditionList.CountHasExpirationCondition()} conditions contain an expiration condition");

// Count based on expiration time, using real-world time (in seconds)
Debug.Log($"There are {gameConditionList.CountExpiringBeforeRealTime(timeToAdd)} expiring before {timeToAdd} additional real-world seconds");
Debug.Log($"There are {gameConditionList.CountExpiringAfterRealTime(timeToAdd)} expiring after {timeToAdd} additional real-world seconds");

// Count based on expiration time, using in-game TimeSpan periods
float seconds = 0f;
float minutes = 0f;
float hours = 0f;
float days = 0f;
float weeks = 2f; // We will look for values based on 2 weeks of in-game time
Debug.Log($"There are {gameConditionList.CountExpiringBefore(seconds, minutes, hours, days, weeks)} expiring before the additional in-game time");
Debug.Log($"There are {gameConditionList.CountExpiringAfter(seconds, minutes, hours, days, weeks)} expiring after the additional in-game time");

// Count based on expiration time, using a TimeSpan object (in-game time)
Debug.Log($"There are {gameConditionList.CountExpiringBefore(timeSpan)} expiring before the timeSpan value from now.");
Debug.Log($"There are {gameConditionList.CountExpiringAfter(timeSpan)} expiring after the timeSpan value from now.");

Last updated