/// <summary> /// Set a global counter to a specific value /// </summary> /// <param name="name">The name of the counter</param> /// <param name="value">The value of the counter</param> public void SetGlobalCounter(string name, int value) { GlobalMeta.SetCounter(name, value); }
/// <summary> /// Increment a global counter in the public scope, will add if it doesn't exist (starting from 0) /// </summary> /// <param name="name">The name of the counter</param> /// <param name="increment">The value to increment the counter by</param> /// <returns>The new value of the counter</returns> public int IncrementGlobalCounter(string name, int increment) { return(GlobalMeta.IncrementCounter(name, increment)); }
/// <summary> /// Set a global counter to a specific value /// </summary> /// <param name="name">The name of the counter</param> /// <param name="value">The value of the counter</param> /// <param name="privateScope">Whether to add in private scope</param> public void SetGlobalCounter(string name, int value, bool privateScope) { string fullName = privateScope ? GeneralUtils.MakePrivateMetaName(Uuid, name) : name; GlobalMeta.SetCounter(fullName, value); }
/// <summary> /// Get a counter from the global meta public scope /// </summary> /// <param name="name">The name of the counter</param> /// <param name="defaultValue">The default value if it doesn't exist</param> /// <returns>The current value of the counter</returns> public int GetGlobalCounter(string name, int defaultValue) { return(GlobalMeta.GetCounter(name, defaultValue)); }
/// <summary> /// Increment a global counter, will add if it doesn't exist (starting from 0) /// </summary> /// <param name="name">The name of the counter</param> /// <param name="increment">The value to increment the counter by</param> /// <param name="privateScope">Whether to add in private scope</param> /// <returns>The new value of the counter</returns> public int IncrementGlobalCounter(string name, int increment, bool privateScope) { string fullName = privateScope ? GeneralUtils.MakePrivateMetaName(Uuid, name) : name; return(GlobalMeta.IncrementCounter(fullName, increment)); }
/// <summary> /// Set a global meta value, in the public scope /// </summary> /// <param name="name">The name of the meta parameter</param> /// <param name="obj">The dynamic object, set to null to remove</param> public void SetGlobalMeta(string name, dynamic obj) { GlobalMeta.SetMeta(name, obj); }
/// <summary> /// Get a counter from the global meta /// </summary> /// <param name="name">The name of the counter</param> /// <param name="defaultValue">The default value if it doesn't exist</param> /// <param name="privateScope">Whether to add in private scope</param> /// <returns>The current value of the counter</returns> public int GetGlobalCounter(string name, int defaultValue, bool privateScope) { string fullName = privateScope ? GeneralUtils.MakePrivateMetaName(Uuid, name) : name; return(GlobalMeta.GetCounter(fullName, defaultValue)); }
/// <summary> /// Set a global meta value /// </summary> /// <param name="name">The name of the meta parameter</param> /// <param name="obj">The dynamic object, set to null to remove</param> /// <param name="privateScope">If true then added to private meta scope</param> public void SetGlobalMeta(string name, dynamic obj, bool privateScope) { string fullName = privateScope ? GeneralUtils.MakePrivateMetaName(Uuid, name) : name; GlobalMeta.SetMeta(fullName, obj); }
/// <summary> /// Get a global meta value, if it does not exist then add to the meta /// </summary> /// <param name="name">The name of the meta parameter</param> /// <param name="defaultValue">The default value to add, if null no value will be added</param> /// <param name="privateScope">If true then searches the private scope</param> /// <returns>The dynamic object the default value if it does not exist</returns> public dynamic GetGlobalMeta(string name, dynamic defaultValue, bool privateScope) { string fullName = privateScope ? GeneralUtils.MakePrivateMetaName(Uuid, name) : name; return(GlobalMeta.GetMeta(fullName, defaultValue)); }
/// <summary> /// Get a global meta value from the public scope, if it does not exist then add to the meta /// </summary> /// <param name="name">The name of the meta parameter</param> /// <param name="defaultValue">The default value to add, if null no value will be added</param> /// <returns>The dynamic object the default value if it does not exist</returns> public dynamic GetGlobalMeta(string name, dynamic defaultValue) { return(GlobalMeta.GetMeta(name, defaultValue)); }
/// <summary> /// Get a global meta value from the public scope /// </summary> /// <param name="name">The name of the meta parameter</param> /// <returns>The dynamic object or null if not found</returns> public dynamic GetGlobalMeta(string name) { return(GlobalMeta.GetMeta(name)); }
public void Initialise(GameState state) { //field checks Debug.Assert(string.IsNullOrEmpty(tagGlobalAIName) == false, "Invalid tagGlobalAIName (Null or Empty)"); Debug.Assert(string.IsNullOrEmpty(tagGlobalDrug) == false, "Invalid tagGlobalDrug (Null or Empty)"); //main int num; GlobalMeta[] arrayOfGlobalMeta = GameManager.i.loadScript.arrayOfGlobalMeta; num = arrayOfGlobalMeta.Length; if (num > 0) { for (int i = 0; i < num; i++) { GlobalMeta assetSO = arrayOfGlobalMeta[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign GlobalMeta.level values (0/1/2). switch (assetSO.name) { case "Local": metaBottom = assetSO; assetSO.level = 0; break; case "State": metaMiddle = assetSO; assetSO.level = 1; break; case "National": metaTop = assetSO; assetSO.level = 2; break; default: Debug.LogWarningFormat("Invalid meta \"{0}\"", assetSO.name); break; } } //error check if (metaBottom == null) { Debug.LogError("Invalid metaBottom (Null)"); } if (metaMiddle == null) { Debug.LogError("Invalid metaMiddle (Null)"); } if (metaTop == null) { Debug.LogError("Invalid metaTop (Null)"); } } // // - - - GlobalChance - - - // GlobalChance[] arrayOfGlobalChance = GameManager.i.loadScript.arrayOfGlobalChance; num = arrayOfGlobalChance.Length; if (num > 0) { for (int i = 0; i < num; i++) { GlobalChance assetSO = arrayOfGlobalChance[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign GlobalChance.level values (0/1/2). switch (assetSO.name) { case "Low": chanceLow = assetSO; assetSO.level = 0; break; case "Medium": chanceMedium = assetSO; assetSO.level = 1; break; case "High": chanceHigh = assetSO; assetSO.level = 2; break; case "Extreme": chanceExtreme = assetSO; assetSO.level = 3; break; default: Debug.LogWarningFormat("Invalid chance \"{0}\"", assetSO.name); break; } } //error check if (chanceLow == null) { Debug.LogError("Invalid chanceLow (Null)"); } if (chanceMedium == null) { Debug.LogError("Invalid chanceMedium (Null)"); } if (chanceHigh == null) { Debug.LogError("Invalid chanceHigh (Null)"); } if (chanceExtreme == null) { Debug.LogError("Invalid chanceCritical (Null)"); } } // // - - - GlobalWho - - - // GlobalWho[] arrayOfGlobalWho = GameManager.i.loadScript.arrayOfGlobalWho; num = arrayOfGlobalWho.Length; if (num > 0) { for (int i = 0; i < num; i++) { GlobalWho assetSO = arrayOfGlobalWho[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign GlobalWho.level values (0/1/2). switch (assetSO.name) { case "Player": whoPlayer = assetSO; assetSO.level = 0; break; case "Actor": whoActor = assetSO; assetSO.level = 1; break; default: Debug.LogWarningFormat("Invalid GlobalWho \"{0}\"", assetSO.name); break; } } //error check if (whoPlayer == null) { Debug.LogError("Invalid whoPlayer (Null)"); } if (whoActor == null) { Debug.LogError("Invalid whoActor (Null)"); } } // // - - - GlobalType - - - // GlobalType[] arrayOfGlobalType = GameManager.i.loadScript.arrayOfGlobalType; num = arrayOfGlobalType.Length; if (num > 0) { for (int i = 0; i < num; i++) { GlobalType assetSO = arrayOfGlobalType[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign GlobalType.level values (0/1/2). switch (assetSO.name) { case "Bad": typeBad = assetSO; assetSO.level = 0; break; case "Neutral": typeNeutral = assetSO; assetSO.level = 1; break; case "Good": typeGood = assetSO; assetSO.level = 2; break; default: Debug.LogWarningFormat("Invalid type \"{0}\"", assetSO.name); break; } } //error check if (typeBad == null) { Debug.LogError("Invalid typeBad (Null)"); } if (typeNeutral == null) { Debug.LogError("Invalid typeNeutral (Null)"); } if (typeGood == null) { Debug.LogError("Invalid typeGood (Null)"); } } // // - - - GlobalSide - - - // GlobalSide[] arrayOfGlobalSide = GameManager.i.loadScript.arrayOfGlobalSide; num = arrayOfGlobalSide.Length; if (num > 0) { for (int i = 0; i < num; i++) { GlobalSide assetSO = arrayOfGlobalSide[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign GlobalSide.level values (0/1/2). switch (assetSO.name) { case "AI": sideAI = assetSO; assetSO.level = 0; break; case "Authority": sideAuthority = assetSO; assetSO.level = 1; break; case "Resistance": sideResistance = assetSO; assetSO.level = 2; break; case "Both": sideBoth = assetSO; assetSO.level = 3; break; default: Debug.LogWarningFormat("Invalid side \"{0}\"", assetSO.name); break; } } //error check Debug.Assert(sideAI != null, "Invalid sideAI (Null)"); Debug.Assert(sideAuthority != null, "Invalid sideAuthority (Null)"); Debug.Assert(sideResistance != null, "Invalid sideResistance (Null)"); Debug.Assert(sideBoth != null, "Invalid sideBoth (Null)"); } NodeDatapoint[] arrayOfNodeDatapoints = GameManager.i.loadScript.arrayOfNodeDatapoints; num = arrayOfNodeDatapoints.Length; if (num > 0) { for (int i = 0; i < num; i++) { NodeDatapoint assetSO = arrayOfNodeDatapoints[i]; //pick out and assign the ones required for fast acess, ignore the rest. //Also dynamically assign NodeDatapoint.level values (0/1/2). switch (assetSO.name) { case "Stability": nodeStability = assetSO; assetSO.level = 0; break; case "Support": nodeSupport = assetSO; assetSO.level = 1; break; case "Security": nodeSecurity = assetSO; assetSO.level = 2; break; default: Debug.LogWarningFormat("Invalid NodeDatapoint \"{0}\"", assetSO.name); break; } } //error check Debug.Assert(nodeStability != null, "Invalid nodeStability (Null)"); Debug.Assert(nodeSupport != null, "Invalid nodeSupport (Null)"); Debug.Assert(nodeSecurity != null, "Invalid nodeSecurity (Null)"); } // // - - - Trait Categories - - - // categoryActor = GameManager.i.dataScript.GetTraitCategory("Actor"); categoryMayor = GameManager.i.dataScript.GetTraitCategory("Mayor"); Debug.Assert(categoryActor != null, "Invalid categoryActor"); Debug.Assert(categoryMayor != null, "Invalid categoryMayor"); }