ORKFramework.Combatant CBT1 SetName = CBT1_Name.ToString()
ORKFramework.Combatant CBT1 SetClass = CBT1_Class[0]
ORKFramework.Combatant CBT1 SetPrefab = Gameobject.Female.Whitemage;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using GamingIsLove.ORKFramework;
public class CharacterSelectionScreen : MonoBehaviour
{
#region Combatant 0 Variables
public TMP_InputField CBT0_Name;
public Button CBT0_Warrior, CBT0_Monk, CBT0_WhiteMage, CBT0_BlackMage, CBT0_RedMage, CBT0_Thief, CBT0_Male, CBT0_Female, CBT0_Done;
public Image CBT0_PreviewImage;
public bool CBT0War, CBT0MNK, CBT0WHM, CBT0BLM, CBT0RDM, CBT0THF, CBT0MALE, CBT0FEMALE;
#endregion
#region Combatant 1 Variables
public TMP_InputField CBT1_Name;
public Button CBT1_Warrior, CBT1_Monk, CBT1_WhiteMage, CBT1_BlackMage, CBT1_RedMage, CBT1_Thief, CBT1_Male, CBT1_Female, CBT1_Done;
public Image CBT1_PreviewImage;
public bool CBT1War, CBT1MNK, CBT1WHM, CBT1BLM, CBT1RDM, CBT1THF, CBT1MALE, CBT1FEMALE;
#endregion
#region Combatant 2 Variables
public TMP_InputField CBT2_Name;
public Button CBT2_Warrior, CBT2_Monk, CBT2_WhiteMage, CBT2_BlackMage, CBT2_RedMage, CBT2_Thief, CBT2_Male, CBT2_Female, CBT2_Done;
public Image CBT2_PreviewImage;
public bool CBT2War, CBT2MNK, CBT2WHM, CBT2BLM, CBT2RDM, CBT2THF, CBT2MALE, CBT2FEMALE;
#endregion
#region Combatant 3 Variables
public TMP_InputField CBT3_Name;
public Button CBT3_Warrior, CBT3_Monk, CBT3_WhiteMage, CBT3_BlackMage, CBT3_RedMage, CBT3_Thief, CBT3_Male, CBT3_Female, CBT3_Done;
public Image CBT3_PreviewImage;
public bool CBT3War, CBT3MNK, CBT3WHM, CBT3BLM, CBT3RDM, CBT3THF, CBT3MALE, CBT3FEMALE;
#endregion
// Start is called before the first frame update
void Start() { }
// Update is called once per frame
void Update() { }
#region Combatant 1 Functions
public void CBT0_WARClick() { CBT0War = true; CBT0MNK = false; CBT0WHM = false; CBT0BLM = false; CBT0RDM = false; CBT0THF = false; }
public void CBT0_MNKClick() { CBT0MNK = true; CBT0War = false; CBT0WHM = false; CBT0BLM = false; CBT0RDM = false; CBT0THF = false; }
public void CBT0_WHMClick() { CBT0WHM = true; CBT0MNK = false; CBT0War = false; CBT0BLM = false; CBT0RDM = false; CBT0THF = false; }
public void CBT0_BLMClick() { CBT0BLM = true; CBT0MNK = false; CBT0War = false; CBT0WHM = false; CBT0RDM = false; CBT0THF = false; }
public void CBT0_RDMClick() { CBT0RDM = true; CBT0MNK = false; CBT0War = false; CBT0WHM = false; CBT0BLM = false; CBT0THF = false; }
public void CBT0_THFClick() { CBT0THF = true; CBT0MNK = false; CBT0War = false; CBT0WHM = false; CBT0BLM = false; CBT0RDM = false; }
public void CBT0_MaleClick() { CBT0MALE = true; CBT0FEMALE = false; }
public void CBT0_FemaleClick() { CBT0MALE = false; CBT0FEMALE = true; }
void CBT0ChangePlayername()
{
Combatant CBT0 = ORK.Game.Combatants.Get(0);
CBT0.Setting.EditorName = CBT0_Name.ToString();
}
// ORKFramework.Combatant CBT0 SetName = CBT0_Name.ToString()
// ORKFramework.Combatant CBT0 SetClass = CBT0_Class[0]
// ORKFramework.Combatant CBT0 SetPrefab = Gameobject.Female.Whitemage
#endregion
}
public override float manaValue => _Combatant.Status[(int)OrkStatusValue.ETHER].GetValue(); //Assumes Index 3 is Ork Mana Value
using GamingIsLove.ORKFramework;
public partial class ABC_IEntity
{
private Combatant combatant;
public void Start()
{
//Registers to the combatant's status value changes
combatant.Status[0].SimpleChanged += StatusValueChanged;
combatant.Status[1].SimpleChanged += StatusValueChanged;
combatant.Status[2].SimpleChanged += StatusValueChanged;
combatant.Status[3].SimpleChanged += StatusValueChanged;
combatant.Status[4].SimpleChanged += StatusValueChanged;
combatant.Status[5].SimpleChanged += StatusValueChanged;
combatant.Status[10].SimpleChanged += StatusValueChanged;
combatant.Status[11].SimpleChanged += StatusValueChanged;
combatant.Status[12].SimpleChanged += StatusValueChanged;
combatant.Status[13].SimpleChanged += StatusValueChanged;
combatant.Status[14].SimpleChanged += StatusValueChanged;
combatant.Status[15].SimpleChanged += StatusValueChanged;
combatant.Status[16].SimpleChanged += StatusValueChanged;
combatant.Status[17].SimpleChanged += StatusValueChanged;
combatant.Status[18].SimpleChanged += StatusValueChanged;
combatant.Status[19].SimpleChanged += StatusValueChanged;
combatant.Status[20].SimpleChanged += StatusValueChanged;
combatant.Status[26].SimpleChanged += StatusValueChanged;
}
public void StatusValueChanged() //Function to be called whenever registered status effects change
{
}
public Combatant OrkStats
{
get
{
//If ani runner is null for any reason then reassign the component
if (this.combatant == null)
{
_ = ORKComponentHelper.GetCombatant(this.gameObject); //Gets Combatant from a game object
}
return this.combatant;
}
}
#region ABC TO ORK STATS
/// <summary>
/// Ork Framework 3 doesn't have predefined Stats, aka Status Values. So the name/ID of the Health, Mana and the rest, can be anything. I generally try to keep my stats in the character sheet type minor to make it easier to tell where the stats are.
///
/// ORK USES INT VALUES SO EACH FUNCTION USES CASTING
///
/// </summary>
/// <summary>
/// Returns entities Current Health Value
/// </summary>
public override float healthValue => combatant.Status[(int)OrkStatusValue.LIFEFORCE].GetValue(); //Assumes Index 1 as Ork Health Value
/// <summary>
/// Returns entities Max Health Value
/// </summary>
public override float maxHealthValue => combatant.Status[(int)OrkStatusValue.BRINK].GetValue(); //Assumes Index 0 as ORK MaxHealth
/// <summary>
/// Returns entities Max Mana Value
/// </summary>
public override float maxManaValue => combatant.Status[(int)OrkStatusValue.MAXETHER].GetValue(); //Assumes Index 2 as Ork MaxMana
/// <summary>
/// Returns entities Current Mana Value
/// </summary>
public override float manaValue => combatant.Status[(int)OrkStatusValue.ETHER].GetValue(); //Assumes Index 3 is Ork Mana Value
/// <summary>
/// Will Adjust the entities health
/// </summary>
/// <param name="Potency">Amount to adjust health by (can be positive or negative)</param>
public override void AdjustHealth(float Potency) => combatant.Status[(int)OrkStatusValue.LIFEFORCE].SetValue((int)Potency,
false,
true,
true,
false,
false,
null);
/// <summary>
/// Will Adjust the entities mana
/// </summary>
/// <param name="Potency">Amount to adjust mana by (can be positive or negative)</param>
public override void AdjustMana(float Potency) => combatant.Status[(int)OrkStatusValue.ETHER].SetValue((int)Potency,
false,
true,
true,
false,
false,
null);
/// <summary>
/// Will increase max health
/// </summary>
/// <param name="Amount">Amount to increase max health by</param>
/// <param name="RestoreHealth">If true then health will be restored to full</param>
public override void AdjustMaxHealth(float Amount, bool RestoreHealth = false)
{
if (RestoreHealth)
{
combatant.Status[(int)OrkStatusValue.BRINK].SetValue((int)Amount,
false,
true,
true,
false,
false,
null);
}
else
{
combatant.Status[(int)OrkStatusValue.BRINK].SetBaseValue((int)Amount);
}
}
/// <summary>
/// Will adjust max Mana
/// </summary>
/// <param name="Amount">Amount to adjust max Mana by</param>
/// <param name="RestoreMana">If true then Mana will be restored to full</param>
public override void AdjustMaxMana(float Amount, bool RestoreMana = false)
{
if (RestoreMana)
{
combatant.Status[(int)OrkStatusValue.MAXETHER].SetValue((int)Amount,
false,
true,
true,
false,
false,
null);
}
else
{
combatant.Status[(int)OrkStatusValue.MAXETHER].SetBaseValue((int)Amount);
}
}
/// <summary>
/// Will adjust health regen rate
/// </summary>
/// <param name="Amount">Amount to adjust regen by</param>
public override void AdjustHealthRegen(float Amount)
{
//In ORK regeneration is handled by Ork Status Effects
//combatant.AdjustHealthRegen(Amount);
}
/// <summary>
/// Will adjust mana regen rate
/// </summary>
/// <param name="Amount">Amount to adjust regen by</param>
public override void AdjustManaRegen(float Amount)
{
//In Ork regeneration is handled by Ork Status Effects
//combatant.AdjustManaRegen(Amount);
}
/// <summary>
/// Will return the stat value asked for in the parameter
/// </summary>
/// <param name="StatName">Stat to find value for</param>
/// <param name="IntegrationType">The integration type for stat functionality - if ABC is picked then normal stat functionality is used else stat from another integration system i.e game creator is used</param>>
/// <returns>Value of the stat</returns>
public float GetStatValue(string StatName, ABCIntegrationType IntegrationType = ABCIntegrationType.Ork3Framework)
{
float returnValue = 0;
StatusValue theStatus = GetORKStatByName(StatName);
if (theStatus != null)
{
returnValue = theStatus.GetValue();
}
return returnValue;
}
/// <summary>
/// Will modify a stats value by the amount provided
/// </summary>
/// <param name="StatName">Stat which will have its value modified</param>
/// <param name="Amount">Amount to increase or decrease the stat value by</param>
public void AdjustStatValue(string StatName, float Amount)
{
_ = GetORKStatByName(StatName);
}
// Maybe is not good idea to return just the statusvalue and
// and we might need to repeat the code in both methods above
private StatusValue GetORKStatByName(string statName)
{
StatusValue returnValue = null;
int numberOfStats = ORK.StatusValues.Count;
for (int i = 0; i <= numberOfStats; ++i)
{
if (combatant.Status[i].GetName().Equals(statName))
{
returnValue = combatant.Status[i];
break;
}
}
return returnValue;
}
#endregion
#region INTEGRATION OVERRIDES
/// <summary>
/// Additional partial class overrides for ABCIntegration to smoothline it
/// </summary>
public enum ABCIntegrationType
{
ABC = 0,
GameCreator = 1,
EmeraldAI = 2,
GameCreator2 = 3,
Ork3Framework = 4,
}
#endregion
#region ORK STAT ENUMS
//
//These ENUMs were created to just add more human language to the output and make it easier to debug. I used my own custom stats for my game, but any Ork Status Value can be replaced.
//
public enum OrkStatusValue
{
BRINK = 0, //Maximum Health
LIFEFORCE = 1, //Current Health
MAXETHER = 2, //Maximum Mana
ETHER = 3, //Current Mana
MAXSTAMINA = 4, //Maximum Stamina
STAMINA = 5, //Current Stamina
EXP = 6, //Character Experience
PEXP = 7, //Profession/Class Experience
CP = 8, //Character Points (For Character upgrades)
TP = 9, //Technique Points (For Ability Upgrades)
LOGIC = 10, //Character Stat for Ether Damage
AURA = 11, //Character Stat for force of Personality
CUNNING = 12, //Character stat for crits, stealth and shady things
AWARENESS = 13, //Character stat for physical awareness and senses
POWER = 14, //Character stat for Attack
SPEED = 15, //Character stat for physical speed and dodging
DETERMINATION = 16, //Character stat for mental willpower and using Hekan Arts
FORTITUDE = 17, //Character stat for physical defense
HEKANARTS = 18, //Character stat for using Hekan Arts
ATKSPD = 19, //Character stat for increasing speed of Attacks
CASTSPD = 20, //Character stat for increasing speed of Hekan Arts
ATTACK = 21, //Damage Stat
WEAPONDMG = 22, //Increased Attack with a Weapon
ETHERIALDMG = 23, //Increased Attack with Etherial attacks
SOAK = 24, //Character Attack Defense
ARMOR = 25, //Equipment Defense
DEFENSE = 26, //Total Attack Defense
ETHERIALDEFENSE = 27, //Total Etherial Defense
THORNS = 28, //Amount of Attack Damage done on Hit
CRITHITMOD = 29, //Increases Chance to Hit with Critical
CRITPOWER = 30, //Increases Critical Damage
CRITDEFENSE = 31, //Increases Defense against Critical Attacks
BLOCKCHANCE = 32, //Chance to Block Attacks
BLOCKMOD = 33, //Increases amount of Attack Blocked
ACCMOD = 34, //Increases accuracy of Attacks
DODGE = 35, //Chance to Dodge Attacks
DODGEMOD = 36, //Increases chance to Dodge
AOERADIUS = 37, //Increases radius of Attacks
CCPOWER = 38, //Chance to land a Crowd Control effect
CCRESIST = 39, //Increases chance to resist a Crowd Control effect
SOCIALSKILL = 40, //Increases chance of success in Social events
MOVESPEED = 41, //Increases movement speed of player
CHANCETOBLEED = 42, //Chance to hit with Bleed effect
CHANCETODISADV = 43, //Chance to hit with Disadvantage
CHANCETOKNOCKBACK = 44, //Chance to Knockback enemy
CHANCETOPOISON = 45, //Chance to poison enemy
CHANCETOROOT = 46, //Chance to root enemy in place
CHANCETOSILENCE = 47, //Chance to cease enemy from casting Hekan Arts
CHANCETOSLEEP = 48, //Chance to put enemy to sleep
CHANCETOSTAGGER = 49, //Chance to stagger enemy on hit
CHANCETOSTUN = 50, //Chance to Stun enemy on hit
CHANCETOADV = 51, //Chance too hit with Advantage
DOTBONUS = 52, //Increases Damage over Time effects
ETHEREGENONKILL = 53, //Increases Ether Regeneration on Kill
HOTBONUS = 54, //Increases Heal over Time effects
HEALTHONBLOCK = 55, //Amount of Health returned on Block
HEALTHONKILL = 56, //Amount of Health regained on killing an enemy
HEALTHREGEN = 57, //Amount of Health regnerated per second
LIFESTEAL = 58, //Amount of Health stolen fron enemy on Attack
LOOTCHANCE = 59, //Increases chance for a roll on the Loot Table
PROJECTILECOUNT = 60, //Increases number of projectiles on a projectile Attack
PROJECTILERANGE = 61, //Increases the range of projectiles
PROJECTILESPEED = 62, //Increases the Speed of a projectile
MINIONBRINK = 63, //Minion Maximum Health
MINIONLIFEFORCE = 64, //Minion Current Health
MINIONMAXETHER = 65, //Minion Maximum Ether
MINIONETHER = 66, //Minion Current Ether
MINIONMAXSTAMINA = 67, //Minion Maximum Stamina
MINIONSTAMINA = 68, //Minion Current Stamina
MINIONCRITCHANCE = 69, //Minion Critical Chance
MINIONCRITPOWER = 70, //Minion Critical Power
MINIONATTACK = 71, //Minion Attack
MINIONWEAPONDAMAGE = 72, //Increases Minion Weapon Damage
MINIONETHERIALDMG = 73, //Increases Minion Etherial Damage
MINIONDEFENSE = 74, //Minion Total Defense
MINIONDURATION = 75, //Minion Summoning Duration
MINIONLIFESTEAL = 76, //Minions amount of life stolen on hit
MINIONTHORNS = 77, //Minion Thorns
MINIONCOUNT = 78 //Number of Minions that can be summoned at once
}
}
#endregion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ORKFramework;
using ORKFramework.Behaviours;
namespace Animmal.YezugaRPG
{
public static class BoltHelpers
{
#region ORK
public static void BlockPlayerControl(bool _State)
{
ORK.Control.SetBlockPlayer((_State) ? 1 : -1, true);
}
public static void BlockCameraControl(bool _State)
{
ORK.Control.SetBlockCamera((_State) ? 1 : -1, true);
}
public static void ORKChangeFaction(List<GameObject> _Combatants, int _Faction)
{
List<Combatant> _CombatantsList = ComponentHelper.GetCombatants(_Combatants);
for (int i = 0; i < _CombatantsList.Count; i++)
{
ORKChangeFaction(_CombatantsList[i], _Faction);
}
}
public static void ORKChangeFaction(GameObject _Combatant, int _Faction)
{
ORKChangeFaction(ComponentHelper.GetCombatant(_Combatant), _Faction);
}
public static void ORKChangeFaction(Combatant _Combatant, int _Faction)
{
_Combatant.Group.FactionID = _Faction;
}
public static void SetCameraControlTarget(GameObject _Target)
{
ORK.Control.SetCameraControlTarget(_Target, null);
}
public static void ORKUseAttack(GameObject _User, GameObject _Target, int _AttackIndex)
{
Combatant _UserCombatant = ComponentHelper.GetCombatant(_User);
AbilityShortcut _AbilityShortcut = _UserCombatant.Abilities.GetBaseAttack(_AttackIndex);
if (_AbilityShortcut == null)
{
Debug.LogError("ORKUseAttack: Combatant" + _UserCombatant.GameObject.name + " doesn't have attack with index - " + _AttackIndex.ToString());
return;
}
List<Combatant> _Targets = new List<Combatant>();
_Targets.Add(ComponentHelper.GetCombatant(_Target));
//_AbilityShortcut.GetActiveLevel().UseAccess(_AbilityShortcut, _UserCombatant, _Targets, false, true, false, false, 0, 0, null, null, null);
_AbilityShortcut.Use(_UserCombatant, _Targets, true);
}
public static void ORKUseAbility(GameObject _User, GameObject _Target, int _Ability)
{
Combatant _UserCombatant = ComponentHelper.GetCombatant(_User);
AbilityShortcut _AbilityShortcut = _UserCombatant.Abilities.Get(_Ability);
if (_AbilityShortcut == null)
{
Debug.LogError("ORKUseAbility: Combatant" + _UserCombatant.GameObject.name + " doesn't have ability - " + _Ability.ToString());
return;
}
List<Combatant> _Targets = new List<Combatant>();
_Targets.Add(ComponentHelper.GetCombatant(_Target));
_AbilityShortcut.Use(_UserCombatant, _Targets, false);
}
public static void BlockMoveAI(GameObject _Character, bool _State)
{
MoveAIComponent _MoveAI = _Character.GetComponent<MoveAIComponent>();
if (_MoveAI == null)
{
Debug.LogError("BlockMoveAI: Combatant" + _Character.name + " has no move AI.");
return;
}
_MoveAI.blocked = _State;
}
public static void BlockMoveAI(bool _State)
{
ORK.Control.SetBlockMoveAI(_State ? 1 : -1);
}
public static GameObject GetPlayer
{
get
{
return ORK.Game.ActiveGroup.Leader.GameObject;
}
}
#region VARIABLES
//Bool
public static void ORKSetVariableGlobalBool(string _Key, bool _Value)
{
ORK.Game.Variables.Set(_Key, _Value);
}
public static void ORKSetVariableLocalBool(string _Key, bool _Value, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
_ObjectVariables.GetHandler().Set(_Key, _Value);
}
}
public static bool ORKGetVariableGlobalBool(string _Key)
{
return ORK.Game.Variables.GetBool(_Key);
}
public static bool ORKGetVariableLocalBool(string _Key, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
return _ObjectVariables.GetHandler().GetBool(_Key);
}
return false;
}
//Float
public static void ORKSetVariableGlobalFloat(string _Key, float _Value)
{
ORK.Game.Variables.Set(_Key, _Value);
}
public static void ORKSetVariableLocalFloat(string _Key, float _Value, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
_ObjectVariables.GetHandler().Set(_Key, _Value);
}
}
public static float ORKGetVariableGlobalFloat(string _Key)
{
return ORK.Game.Variables.GetFloat(_Key);
}
public static float ORKGetVariableLocalFloat(string _Key, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
return _ObjectVariables.GetHandler().GetFloat(_Key);
}
return -1f;
}
//String
public static void ORKSetVariableGlobalString(string _Key, string _Value)
{
ORK.Game.Variables.Set(_Key, _Value);
}
public static void ORKSetVariableLocalString(string _Key, string _Value, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
_ObjectVariables.GetHandler().Set(_Key, _Value);
}
}
public static string ORKGetVariableGlobalString(string _Key)
{
return ORK.Game.Variables.GetString(_Key);
}
public static string ORKGetVariableLocalString(string _Key, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
return _ObjectVariables.GetHandler().GetString(_Key);
}
return string.Empty;
}
//Vector3
public static void ORKSetVariableGlobalVector3(string _Key, Vector3 _Value)
{
ORK.Game.Variables.Set(_Key, _Value);
}
public static void ORKSetVariableLocalVector3(string _Key, Vector3 _Value, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
_ObjectVariables.GetHandler().Set(_Key, _Value);
}
}
public static Vector3 ORKGetVariableGlobalVector3(string _Key)
{
return ORK.Game.Variables.GetVector3(_Key);
}
public static Vector3 ORKGetVariableLocalVector3(string _Key, GameObject _GameObject)
{
ORKFramework.Behaviours.ObjectVariablesComponent _ObjectVariables = _GameObject.GetComponent<ORKFramework.Behaviours.ObjectVariablesComponent>();
if (_ObjectVariables != null)
{
return _ObjectVariables.GetHandler().GetVector3(_Key);
}
return Vector3.zero;
}
#endregion
#endregion
}
}
using UnityEngine;
using System.Collections;
using ORKFramework;
public class GameTime : MonoBehaviour,ISaveData
{
#region fields
public int hour;
public int minute;
public int seconds;
public int month;
public int day;
public int year;
public System.DayOfWeek dayOfWeek = System.DayOfWeek.Sunday;
public float timeSpeed = 0.0001f;
public float time;
UniStormWeatherSystem_C weather;
bool weatherFound = false;
#endregion
#region inits
// Use this for initialization
void Awake()
{
ORK.SaveGame.RegisterCustomData("GameTime", this, false);
DontDestroyOnLoad(this.gameObject);
}
void Start ()
{
//load these from a file
hour = 8;
minute = 0;
seconds = 0;
month = 1;
day = 1;
year = 368;
}
void OnLevelWasLoaded()
{
weatherFound = false;
GameObject UniStorm = GameObject.Find("UniStormSystemEditor");
if(!ReferenceEquals (UniStorm,null))
{
weather = UniStorm.GetComponent<UniStormWeatherSystem_C>();
if(!ReferenceEquals(weather,null))
{
weatherFound = true;
}
else
{
weatherFound = false;
}
}
else
{
weatherFound = false;
}
}
#endregion
#region update methods
public void StartTimer()
{
InvokeRepeating("TimeTick", 0, 6); //fires 6 seconds giving us 72 minutes = 1 game day
}
// Update is called once per frame
void TimeTick()
{
//seconds += 60;
minute++;
if(minute > 60)
{
minute = 0;
hour++;
if(hour > 24)
{
hour = 0;
seconds = 0;
day++;
this.dayOfWeek += 1;
if(day > 30)
{
day = 1;
month++;
if(month > 12)
{
month = 1;
year++;
}
}
}
}
if(weatherFound)
{
weather.startTimeHour= hour;
weather.startTimeMinute= minute;
weather.startTime = hour;
weather.LoadTime();
}
}
#endregion
#region temp save/load methods
//call these if you want to change scenes and maintain the time between them
public void SaveGameTime()
{
PlayerPrefs.SetInt("minute", this.minute);
PlayerPrefs.SetInt("hour", this.hour);
PlayerPrefs.SetInt("day", this.day);
PlayerPrefs.SetInt("month", this.month);
PlayerPrefs.SetInt("year", this.year);
PlayerPrefs.SetInt("dayOfWeek", (int)this.dayOfWeek);
}
public void LoadGameTime()
{
int min = PlayerPrefs.GetInt("minute");
int hour = PlayerPrefs.GetInt("hour");
int day = PlayerPrefs.GetInt("day");
int m = PlayerPrefs.GetInt("month");
int y = PlayerPrefs.GetInt("year");
int dow = PlayerPrefs.GetInt("dayOfWeek");
this.minute = min;
this.hour = hour;
this.day = day;
this.month = m;
this.year = y;
SetDayOfWeek(dow);
}
void SetDayOfWeek(int dow)
{
switch(dow)
{
case 0:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
case 1:
this.dayOfWeek = System.DayOfWeek.Monday;
break;
case 2:
this.dayOfWeek = System.DayOfWeek.Tuesday;
break;
case 3:
this.dayOfWeek = System.DayOfWeek.Wednesday;
break;
case 4:
this.dayOfWeek = System.DayOfWeek.Thursday;
break;
case 5:
this.dayOfWeek = System.DayOfWeek.Friday;
break;
case 6:
this.dayOfWeek = System.DayOfWeek.Saturday;
break;
default:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
}
}
#endregion
#region ORK save/load methods
public DataObject SaveGame()
{
DataObject data = new DataObject();
data.Set("hour", this.hour);
data.Set("minute", this.minute);
data.Set("year", this.year);
data.Set("month", this.month);
data.Set("day", this.day);
data.Set("dayOfWeek", (int)this.dayOfWeek);
return data;
}
public void LoadGame(DataObject data)
{
if (data != null)
{
int dow = 0;
data.Get("hour", ref this.hour);
data.Get("minute", ref this.minute);
data.Get("year", ref this.year);
data.Get("month", ref this.month);
data.Get("day", ref this.day);
data.Get("dayOfWeek", ref dow);
SetDayOfWeek(dow);
PlayerPrefs.SetInt("IsLoadedGame", 1);
}
StartTimer();
}
#endregion
}
using UnityEngine;
using System.Collections;
using ORKFramework;
public class GameTime : MonoBehaviour,ISaveData
{
#region fields
public int hour;
public int minute;
public int seconds;
public int month;
public int day;
public int year;
public System.DayOfWeek dayOfWeek = System.DayOfWeek.Sunday;
public float timeSpeed = 0.0001f;
public float time;
UniStormWeatherSystem_C weather;
bool weatherFound = false;
#endregion
#region inits
// Use this for initialization
void Awake()
{
ORK.SaveGame.RegisterCustomData("GameTime", this, false);
DontDestroyOnLoad(this.gameObject);
}
void Start ()
{
//load these from a file
hour = 8;
minute = 0;
seconds = 0;
month = 1;
day = 1;
year = 368;
}
void OnLevelWasLoaded()
{
weatherFound = false;
if(!ReferenceEquals(zoneInfo,null))
{
if(!zoneInfo.IsIndoors())
{
GameObject UniStorm = GameObject.Find("UniStormSystemEditor");
if(!ReferenceEquals (UniStorm,null))
{
weather = UniStorm.GetComponent<UniStormWeatherSystem_C>();
if(!ReferenceEquals(weather,null))
{
weatherFound = true;
}
else
{
weatherFound = false;
}
}
}
else
{
weatherFound = false;
}
}
}
#endregion
#region update methods
public void StartTimer()
{
InvokeRepeating("TimeTick", 0, 6); //fires 6 seconds giving us 72 minutes = 1 game day
}
// Update is called once per frame
void TimeTick()
{
//seconds += 60;
minute++;
if(minute > 60)
{
minute = 0;
hour++;
if(hour > 24)
{
hour = 0;
seconds = 0;
day++;
this.dayOfWeek += 1;
if(day > 30)
{
day = 1;
month++;
UpdateZoneResets();
if(month > 12)
{
month = 1;
year++;
}
}
}
}
//this populates UniStorm with the time from this script
if(weatherFound)
{
weather.realStartTime = hour;
weather.realStartTimeMinutes = minute;
weather.startTime = hour;
weather.LoadTime();
}
}
#endregion
#region helpers
public string CurrentDay
{
get { return dayOfWeek.ToString(); }
}
public string GetMonth()
{
//returns the name of the month
switch (month)
{
case 1:
return "Deepwinter";
case 2:
return "Wintersdusk";
case 3:
return "Newspring";
case 4:
return "Midspring";
case 5:
return "Springsebb";
case 6:
return "Summersdawn";
case 7:
return "Midsummer";
case 8:
return "Summersend";
case 9:
return "Autumnturn";
case 10:
return "Autumncrest";
case 11:
return "Autumunfade";
case 12:
return "Deepwinter";
default:
return "Deepwinter";
}
}
public string GetDayOfWeek()
{
return dayOfWeek.ToString();
}
public string GetTime()
{
string AMPM = " AM";
if (this.hour >= 12 && this.hour < 24)
AMPM = " PM";
else
AMPM = " AM";
return CalendarHelper.ConvertMilitaryTime(this.hour.ToString()) + ":" + this.minute.ToString("00") + AMPM;
}
public string GetDate()
{
return this.day + " - " + this.dayOfWeek.ToString();
}
public string GetYear()
{
return this.year + "ce";
}
#endregion
public void SaveGameTime()
{
PlayerPrefs.SetInt("minute", this.minute);
PlayerPrefs.SetInt("hour", this.hour);
PlayerPrefs.SetInt("day", this.day);
PlayerPrefs.SetInt("month", this.month);
PlayerPrefs.SetInt("year", this.year);
PlayerPrefs.SetInt("dayOfWeek", (int)this.dayOfWeek);
}
public void LoadGameTime()
{
int min = PlayerPrefs.GetInt("minute");
int hour = PlayerPrefs.GetInt("hour");
int day = PlayerPrefs.GetInt("day");
int m = PlayerPrefs.GetInt("month");
int y = PlayerPrefs.GetInt("year");
int dow = PlayerPrefs.GetInt("dayOfWeek");
this.minute = min;
this.hour = hour;
this.day = day;
this.month = m;
this.year = y;
SetDayOfWeek(dow);
}
void SetDayOfWeek(int dow)
{
switch(dow)
{
case 0:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
case 1:
this.dayOfWeek = System.DayOfWeek.Monday;
break;
case 2:
this.dayOfWeek = System.DayOfWeek.Tuesday;
break;
case 3:
this.dayOfWeek = System.DayOfWeek.Wednesday;
break;
case 4:
this.dayOfWeek = System.DayOfWeek.Thursday;
break;
case 5:
this.dayOfWeek = System.DayOfWeek.Friday;
break;
case 6:
this.dayOfWeek = System.DayOfWeek.Saturday;
break;
default:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
}
}
#endregion
#region ORK save/load methods
public DataObject SaveGame()
{
DataObject data = new DataObject();
data.Set("hour", this.hour);
data.Set("minute", this.minute);
data.Set("year", this.year);
data.Set("month", this.month);
data.Set("day", this.day);
data.Set("dayOfWeek", (int)this.dayOfWeek);
return data;
}
public void LoadGame(DataObject data)
{
if (data != null)
{
int dow = 0;
data.Get("hour", ref this.hour);
data.Get("minute", ref this.minute);
data.Get("year", ref this.year);
data.Get("month", ref this.month);
data.Get("day", ref this.day);
data.Get("dayOfWeek", ref dow);
SetDayOfWeek(dow);
PlayerPrefs.SetInt("IsLoadedGame", 1);
}
StartTimer();
}
#endregion
}
using UnityEngine;
using System.Collections;
using ORKFramework;
public class GameTime : MonoBehaviour,ISaveData
{
#region fields
public int hour;
public int minute;
public int seconds;
public int month;
public int day;
public int year;
public System.DayOfWeek dayOfWeek = System.DayOfWeek.Sunday;
public float time;
ZoneInfo zoneInfo; //used in my game just holds information about a map
UniStormWeatherSystem_C weather;
bool weatherFound = false;
#endregion
#region inits
// Use this for initialization
void Awake()
{
ORK.SaveGame.RegisterCustomData("GameTime", this, false);
DontDestroyOnLoad(this.gameObject);
}
void Start ()
{
//load these from a file
hour = 8;
minute = 0;
seconds = 0;
month = 1;
day = 1;
year = 368;
}
void OnLevelWasLoaded()
{
weatherFound = false;
zoneInfo = GameObject.FindGameObjectWithTag("zoneinfo").GetComponent<ZoneInfo>();
if(!ReferenceEquals(zoneInfo,null))
{
if(!zoneInfo.IsIndoors())
{
GameObject UniStorm = GameObject.Find("UniStormSystemEditor");
if(!ReferenceEquals (UniStorm,null))
{
weather = UniStorm.GetComponent<UniStormWeatherSystem_C>();
if(!ReferenceEquals(weather,null))
{
weatherFound = true;
}
else
{
weatherFound = false;
}
}
}
else
{
weatherFound = false;
}
}
}
#endregion
#region update methods
public void StartTimer()
{
InvokeRepeating("TimeTick", 0, 6); //fires 6 seconds giving us 72 minutes = 1 game day
}
// Update is called once per frame
void TimeTick()
{
//seconds += 60;
minute++;
if(minute > 60)
{
minute = 0;
hour++;
if(hour > 24)
{
hour = 0;
seconds = 0;
day++;
this.dayOfWeek += 1;
if(day > 30)
{
day = 1;
month++;
if(month > 12)
{
month = 1;
year++;
}
}
}
}
if(weatherFound)
{
weather.realStartTime = hour;
weather.realStartTimeMinutes = minute;
weather.startTime = hour;
weather.LoadTime();
}
}
#endregion
#region getters
public string CurrentDay
{
get { return dayOfWeek.ToString(); }
}
public string GetMonth()
{
//returns the name of the month
switch (month)
{
case 1:
return "Deepwinter";
case 2:
return "Wintersdusk";
case 3:
return "Newspring";
case 4:
return "Midspring";
case 5:
return "Springsebb";
case 6:
return "Summersdawn";
case 7:
return "Midsummer";
case 8:
return "Summersend";
case 9:
return "Autumnturn";
case 10:
return "Autumncrest";
case 11:
return "Autumunfade";
case 12:
return "Deepwinter";
default:
return "Deepwinter";
}
}
public string GetDayOfWeek()
{
return dayOfWeek.ToString();
}
public string GetTime()
{
string AMPM = " AM";
if (this.hour >= 12 && this.hour < 24)
AMPM = " PM";
else
AMPM = " AM";
return CalendarHelper.ConvertMilitaryTime(this.hour.ToString()) + ":" + this.minute.ToString("00") + AMPM;
}
public string GetDate()
{
return this.day + " - " + this.dayOfWeek.ToString();
}
public string GetYear()
{
return this.year + "ce";
}
#endregion
#region gameplay
public void AdvanceDays(int numDays)
{
this.day += numDays;
//advance the day of the week
for (int x = 0; x < numDays; x++)
{
this.dayOfWeek += 1;
}
}
void TimeCheck()
{
if (this.hour >= 24)
{
this.hour = 0;
this.day++;
this.dayOfWeek += 1;
if (this.day >= 30)
{
this.day = 1;
this.month++;
if (this.month >= 12)
{
this.month = 1;
this.year++;
}
}
}
}
public void Rest()
{
if (!zoneInfo.IsCity())
{
CancelInvoke("TimeTick");
this.hour += 8;
TimeCheck();
if (weatherFound)
{
weather.realStartTime = hour;
weather.realStartTimeMinutes = minute;
weather.startTime = hour;
weather.LoadTime();
}
StartTimer();
}
}
public void WaitOneHour()
{
CancelInvoke("TimeTick");
this.hour += 1;
TimeCheck();
if (weatherFound)
{
weather.realStartTime = hour;
weather.realStartTimeMinutes = minute;
weather.startTime = hour;
weather.LoadTime();
}
StartTimer();
}
public void WaitFourHours()
{
CancelInvoke("TimeTick");
this.hour += 4;
TimeCheck();
if (weatherFound)
{
weather.realStartTime = hour;
weather.realStartTimeMinutes = minute;
weather.startTime = hour;
weather.LoadTime();
}
StartTimer();
}
#endregion
#region temp save/load methods
public void SaveGameTime()
{
PlayerPrefs.SetInt("minute", this.minute);
PlayerPrefs.SetInt("hour", this.hour);
PlayerPrefs.SetInt("day", this.day);
PlayerPrefs.SetInt("month", this.month);
PlayerPrefs.SetInt("year", this.year);
PlayerPrefs.SetInt("dayOfWeek", (int)this.dayOfWeek);
}
public void LoadGameTime()
{
int min = PlayerPrefs.GetInt("minute");
int hour = PlayerPrefs.GetInt("hour");
int day = PlayerPrefs.GetInt("day");
int m = PlayerPrefs.GetInt("month");
int y = PlayerPrefs.GetInt("year");
int dow = PlayerPrefs.GetInt("dayOfWeek");
this.minute = min;
this.hour = hour;
this.day = day;
this.month = m;
this.year = y;
SetDayOfWeek(dow);
}
void SetDayOfWeek(int dow)
{
switch(dow)
{
case 0:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
case 1:
this.dayOfWeek = System.DayOfWeek.Monday;
break;
case 2:
this.dayOfWeek = System.DayOfWeek.Tuesday;
break;
case 3:
this.dayOfWeek = System.DayOfWeek.Wednesday;
break;
case 4:
this.dayOfWeek = System.DayOfWeek.Thursday;
break;
case 5:
this.dayOfWeek = System.DayOfWeek.Friday;
break;
case 6:
this.dayOfWeek = System.DayOfWeek.Saturday;
break;
default:
this.dayOfWeek = System.DayOfWeek.Sunday;
break;
}
}
#endregion
#region save/load methods
public DataObject SaveGame()
{
DataObject data = new DataObject();
data.Set("hour", this.hour);
data.Set("minute", this.minute);
data.Set("year", this.year);
data.Set("month", this.month);
data.Set("day", this.day);
data.Set("dayOfWeek", (int)this.dayOfWeek);
return data;
}
public void LoadGame(DataObject data)
{
if (data != null)
{
int dow = 0;
data.Get("hour", ref this.hour);
data.Get("minute", ref this.minute);
data.Get("year", ref this.year);
data.Get("month", ref this.month);
data.Get("day", ref this.day);
data.Get("dayOfWeek", ref dow);
SetDayOfWeek(dow);
PlayerPrefs.SetInt("IsLoadedGame", 1);
}
StartTimer();
}
#endregion
}
#region ORK Methods
public void SetSpeed(float speed)
{
agent.speed = speed;
}
public void SetTarget(Vector3 target)
{
agent.destination = target;
}
public void StopMovement()
{
agent.speed = 0;
}
#endregion
public class HookupUniStorm : MonoBehaviour
{
#region fields
public GameObject unistorm;
public GameObject unicamera;
public GameObject rain;
public GameObject rainStreaks;
public GameObject snow;
public GameObject butterflies;
public GameObject mistFog;
public GameObject snowMistFog;
public GameObject mistCloud;
public GameObject windyLeaves;
public GameObject lightningBolt1;
#endregion
// Use this for initialization
void Start ()
{
unistorm = GameObject.FindGameObjectWithTag("UniStorm");
if (!ReferenceEquals (unistorm,null))
{
UniStormWeatherSystem_C[] weathers = unistorm.GetComponentsInChildren<UniStormWeatherSystem_C>();
UniStormWeatherSystem_C weather = weathers[0];
if (!ReferenceEquals (weather,null))
{
weather.rain = rain;
weather.snow = snow;
weather.butterflies = butterflies;
weather.mistFog = mistFog;
weather.snowMistFog = snowMistFog;
weather.mistCloud = mistCloud;
weather.windyLeaves = windyLeaves;
weather.lightningBolt1 = lightningBolt1;
weather.cameraThing = unicamera;
}
}
}
}
sing UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ORKFramework;
using ORKFramework.Behaviours;
public class EquipWeapon : MonoBehaviour
{
#region fields
Combatant combatant;
#endregion
#region init
// Use this for initialization
void Start ()
{
combatant = ComponentHelper.GetCombatant(gameObject);
if(combatant != null)
{
if (combatant.Inventory.HasWeapons())
{
List<IShortcut> wpns = combatant.Inventory.GetContent(combatant,false,false,true,false);
if(wpns.Count > 0)
{
IShortcut wpn = null;
//now choose a random weapon from the list to equip
int roll = DiceBag.Custom(0,wpns.Count-1);
if (wpns.Count == 1)
{
wpn = wpns[0]; //wpns.RandomObject();
}
else
{
wpn = wpns[roll]; //wpns.RandomObject();
}
if(wpn != null)
{
//create the shortcut and equip the item
EquipShortcut es = new EquipShortcut(EquipSet.Weapon,wpn.ID,1,1);
combatant.Equipment.Equip (2,es,null,false); //2 is my primary weapon slot which has an equipmentviewer attached. This is where the weapon will be displayed.
combatant.MarkResetStatus();
}
}
}
//we could add shields and helms here
}
}
#endregion
}
It looks like you're new here. If you want to get involved, click one of these buttons!