MOST Gate
A configurable gate system with input/output logic (math/custom), automatic text labeling (positive, negative, or empty), animations, and a customizable output hook with model management.

Gate Structure

Depending on the Gate Text (Output), MOST_Gate will automatically select the active model between Positive, Negative, and Custom models, all directly in edit mode

All Gate Models properties are optional to add...
There are no restrictions on the gate object/prefab structure; you can customize or rebuild the gate system without any restrictions
You will find tons of gate structures inside Gate prefabs folder
Gate Post (TMP) is a Text to display the main gate output text
Fixed Output (TMP) is a Text to display the secondary gate output text (Fixed because it can't be edited by upgrade).
Set up The Gate
Gate Output: Set the text as a string. Numbers must start with a sign (+, -, x, ÷), with option to hide the sign The gate will automatically detect the type of output and activate the target game model
Gate Type: As an enum menu... You can add/edit types from Most_Gate cs Line 25
public enum GateType
{
Health,
FireRate,
FireRange,
Upgrade,
AddChildren,
Currency,
Other /* Edit or Add More Types */
}
Trigger the gate:
// Use the gate calculations to return the output and use it on your objects
Most_Gate.Calculation(); // returns the output text if it's a number
// ex: x6 returns 6, +5 returns 5, -3 returns -3
Most_Gate.Calculation(float input); // returns the output equation with the input
// ex: input = 10, gate text = +5, returns 15
Use Calculation() on your objects to trigger the gate
// In Game Example...
// A game object with a collision system has power and health property
using UnityEngine;
public class CharacterControl_Gun : MonoBehaviour
{
[Tooltip("This value will be updated using MOST_Gate")]
[Min(0)] public float Power = 10;
[Min(0)] public float Health = 50;
// if this game object triggers a gate object
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Gate")) // Gate tag check
{
// accepts only if the object has Most_Gate system
if (other.GetComponent<Most_Gate>())
GateTriggered(other.GetComponent<Most_Gate>());
}
}
void GateTriggered(Most_Gate gate)
{
if (gate.IsCollected) return; // if this gate not triggered before
switch (gate.Type) // Type Check
{
case Most_Gate.GateType.Upgrade:
Power = gate.Calculation(Power);
break;
case Most_Gate.GateType.Upgrade:
Health = gate.Calculation(Health);
break;
default: Debug.Log("This Gate type is not defined on this character control");
}
}
MORE... API reference
All public properties can be updated at runtime, and the changes will be set immediately.
// Next to each line shows the return and set data Type
Most_Gate.Calculation(); // returns the output text if it's a number
// ex: x6 returns 6, +5 returns 5, -3 returns -3
Most_Gate.Calculation(float input); // returns the output equation with the input
// ex: input = 10, gate text = +5, returns 15
Most_Gate.GetSign(); // returns a custom enum from Solo.MOST.IN.ONE namespace
{ Plus, Minus, Subtract, Multiply, NoSign }
// NoSign for non-num output
//_______________________________________________________________//
// return Gate Type
// You can update the Gate type at runtime without any issues
Most_Gate.Type return enum GateType
// true if this gate got triggered / Calculation()
Most_Gate.IsCollected return bool
// Main Gate output
Most_Gate.GateText return or set
// secondary Gate output
Most_Gate.OutputText return or set
// controls the output calculations scale
// for example // if the output +10 and rescale = 0.1f the calculation() will return 10 * .1f
Most_Gate.AmountRescale return or set
// make secondary gate output the target output in the calculation
Most_Gate.EnableFixedOutput return or set
// controls the upgrade system. enable or disable
Most_Gate.EnableUpgrade return or set
Last updated