Topic: Additional Static Gauge/Meter [Tutorial] (Source Only) Edited
Search for "Updated Additional Gauge/Meter [Tutorial]" in the Second Page
Original Tutorial Below, Completely disregard all of this here
I say Static because I Mean the Gauge is uneditable in the editors.
only editable in code.
Starting Off we will need to create the Variables needed for the gauges
so head over and Open up the CharacterInfo.Cs file
Look for this bit of code near the top of the document
[System.Serializable]
public class CharacterInfo: ScriptableObject {
public Texture2D profilePictureSmall;
public Texture2D profilePictureBig;
public string characterName;
public Gender gender;
public string characterDescription;
public AnimationClip selectionAnimation;
public AudioClip selectionSound;
public AudioClip deathSound;
public float height;
public int age;
public string bloodType;
public int lifePoints = 1000;
public int maxGaugePoints;
and right under the last line shown above add:
public int maxGauge2Points;
now scroll to the very bottom of the page look for :
public CombatStances currentCombatStance{get; set;}
public float currentLifePoints{get; set;}
public float currentGaugePoints { get; set; }
and right under that add
public float currentGauge2Points { get; set; }
Save the document we're finished here
Now we want to Edit the CharacterEditorWindow.cs
Search for this bit of code:
EditorGUILayout.BeginVertical();{
EditorGUIUtility.labelWidth = 90;
characterInfo.characterName = EditorGUILayout.TextField("Name:", characterInfo.characterName);
characterInfo.age = EditorGUILayout.IntField("Age:", characterInfo.age);
bloodTypeChoice = EditorGUILayout.Popup("Blood Type:", bloodTypeChoice, bloodTypeChoices);
characterInfo.bloodType = bloodTypeChoices[bloodTypeChoice];
characterInfo.gender = (Gender) EditorGUILayout.EnumPopup("Gender:", characterInfo.gender);
characterInfo.height = EditorGUILayout.FloatField("Height:", characterInfo.height);
characterInfo.lifePoints = EditorGUILayout.IntField("Life Points:", characterInfo.lifePoints);
characterInfo.maxGaugePoints = EditorGUILayout.IntField("Max Gauge:", characterInfo.maxGaugePoints);
immediately after the last line add
characterInfo.maxGauge2Points = EditorGUILayout.IntField("Max Gauge2:", characterInfo.maxGauge2Points);
thats it here just the single line of code. save then time to move on
Open up the MoveSetScript.cs
find this code
private bool hasEnoughGauge(float gaugeNeeded){
if (!UFE.config.gameGUI.hasGauge) return true;
if (controlsScript.myInfo.currentGaugePoints < (controlsScript.myInfo.maxGaugePoints * (gaugeNeeded / 100))) return false;
return true;
}
put a line after the last }
and paste this :
private bool hasEnoughGauge2(float gaugeNeeded)
{
if (!UFE.config.gameGUI.hasGauge2) return true;
if (controlsScript.myInfo.currentGauge2Points < (controlsScript.myInfo.maxGauge2Points * (gaugeNeeded / 100))) return false;
return true;
}
Done here, Save and Move on
MoveEditorWindow.cs
Look for this code
if (moveInfo.gaugeToggle){
EditorGUILayout.BeginVertical(subGroupStyle);{
EditorGUILayout.Space();
EditorGUI.indentLevel += 2;
SubGroupTitle("Self");
moveInfo.gaugeGainOnHit = StyledSlider("Gauge Gain on Hit (%)", moveInfo.gaugeGainOnHit, EditorGUI.indentLevel, 0, 100);
moveInfo.gaugeGainOnMiss = StyledSlider("Gauge Gain on Cast (%)", moveInfo.gaugeGainOnMiss, EditorGUI.indentLevel, 0, 100);
moveInfo.gaugeGainOnBlock = StyledSlider("Gauge Gain on Block (%)", moveInfo.gaugeGainOnBlock, EditorGUI.indentLevel, 0, 100);
moveInfo.gaugeRequired = StyledSlider("Gauge Required (%)", moveInfo.gaugeRequired, EditorGUI.indentLevel, 0, 100);
moveInfo.gaugeUsage = StyledSlider("Gauge Cost (%)", moveInfo.gaugeUsage, EditorGUI.indentLevel, 0, 100);
EditorGUILayout.Space();
and paste this right BEFORE the "EditorGUILayout.Space();"
moveInfo.gauge2GainOnHit = StyledSlider("Gauge2 Gain on Hit (%)", moveInfo.gauge2GainOnHit, EditorGUI.indentLevel, 0, 100);
moveInfo.gauge2GainOnBlock = StyledSlider("Gauge2 Gain on Block (%)", moveInfo.gauge2GainOnBlock, EditorGUI.indentLevel, 0, 100);
moveInfo.gauge2Required = StyledSlider("Gauge2 Required (%)", moveInfo.gauge2Required, EditorGUI.indentLevel, 0, 100);
moveInfo.gauge2Usage = StyledSlider("Gauge2 Cost (%)", moveInfo.gauge2Usage, EditorGUI.indentLevel, 0, 100);
Save this file and move on
We currently called for items that have no variables so we're gonna do that now. Open up MoveInfo.cs
Search For this bit of code
public float opGaugeGainOnBlock;
public float opGaugeGainOnParry;
public float opGaugeGainOnHit;
and right under it add
public float gauge2GainOnHit;
public float gauge2GainOnBlock;
public float opGauge2GainOnHit;
public float opGauge2GainOnBlock;
public float gauge2Required;
public float gauge2Usage;
Save and open GlobalInfo.cs
Search the below code
[System.Serializable]
public class TrainingModeOptions {
public bool inputInfo;
public bool freezeTime;
public float p1StartingLife = 100f;
public float p2StartingLife = 100f;
public float p1StartingGauge = 0f;
public float p2StartingGauge = 0f;
Add immediately after, the "0f" part. you can change this to any number. if you change it to 100. the game will start with the gauge full. any number you put is based on percentage
public float p1StartingGauge2 = 0f;
public float p2StartingGauge2 = 0f;
public LifeBarTrainingMode p1Gauge2;
public LifeBarTrainingMode p2Gauge2;
find this code
[System.Serializable]
public class GameGUI{
public bool hasGauge = true;
add right under
public bool hasGauge2 = true;
Now to Top it all Off we finish with the BattleGui.cs or DefaultBattleGui.cs
At the very top of the document
find
public class DefaultBattleGUI : BattleGUI{
#region public class definitions
[Serializable]
public class PlayerGUI{
public Text name;
public Image portrait;
public Image lifeBar;
public Image gaugeMeter;
add this immediately After
public Image gauge2Meter;
Find this
if (UFE.config.gameGUI.hasGauge){
if (this.player1GUI != null && this.player1GUI.gaugeMeter != null){
this.player1GUI.gaugeMeter.fillAmount = UFE.config.player1Character.currentGaugePoints / UFE.config.player1Character.maxGaugePoints;
}
if (this.player2GUI != null && this.player2GUI.gaugeMeter != null){
this.player2GUI.gaugeMeter.fillAmount = UFE.config.player2Character.currentGaugePoints / UFE.config.player2Character.maxGaugePoints;
}
Add this immediately After
if (this.player1GUI != null && this.player1GUI.gauge2Meter != null)
{
this.player1GUI.gauge2Meter.fillAmount = UFE.config.player1Character.currentGauge2Points / UFE.config.player1Character.maxGauge2Points;
}
if (this.player2GUI != null && this.player2GUI.gauge2Meter != null)
{
this.player2GUI.gauge2Meter.fillAmount = UFE.config.player2Character.currentGauge2Points / UFE.config.player2Character.maxGauge2Points;
}
and that should be everything you need.
if theres any problems please dont hesitate to as for help
Current Projects:
Destined Soels
Always happy to help when possible. If its something pretty minor ill just help you out. But i do commissions as well. Hit me up if you need a commission.