Example #1
0
        public static void Interactables()
        {
            foreach (TeleporterInteraction teleporterInteraction in FindObjectsOfType <TeleporterInteraction>())
            {
                float   distanceToObject = Vector3.Distance(Camera.main.transform.position, teleporterInteraction.transform.position);
                Vector3 Position         = Camera.main.WorldToScreenPoint(teleporterInteraction.transform.position);
                var     BoundingVector   = new Vector3(Position.x, Position.y, Position.z);
                if (BoundingVector.z > 0.01)
                {
                    Main.renderTeleporterStyle.normal.textColor =
                        teleporterInteraction.isIdle ? Color.magenta :
                        teleporterInteraction.isIdleToCharging || teleporterInteraction.isCharging ? Color.yellow :
                        teleporterInteraction.isCharged ? Color.green : Color.yellow;
                    int    distance     = (int)distanceToObject;
                    String friendlyName = "Teleporter";
                    string status       = "" + (
                        teleporterInteraction.isIdle ? "Idle" :
                        teleporterInteraction.isCharging ? "Charging" :
                        teleporterInteraction.isCharged ? "Charged" :
                        teleporterInteraction.isActiveAndEnabled ? "Idle" :
                        teleporterInteraction.isIdleToCharging ? "Idle-Charging" :
                        teleporterInteraction.isInFinalSequence ? "Final-Sequence" :
                        "???");
                    string boxText = $"{friendlyName}\n{status}\n{distance}m";
                    GUI.Label(new Rect(BoundingVector.x - 50f, (float)Screen.height - BoundingVector.y, 100f, 50f), boxText, Main.renderTeleporterStyle);
                }
            }

            foreach (PurchaseInteraction purchaseInteraction in PurchaseInteraction.FindObjectsOfType(typeof(PurchaseInteraction)))
            {
                if (purchaseInteraction.available)
                {
                    float   distanceToObject = Vector3.Distance(Camera.main.transform.position, purchaseInteraction.transform.position);
                    Vector3 Position         = Camera.main.WorldToScreenPoint(purchaseInteraction.transform.position);
                    var     BoundingVector   = new Vector3(Position.x, Position.y, Position.z);
                    if (BoundingVector.z > 0.01)
                    {
                        int    distance     = (int)distanceToObject;
                        String friendlyName = purchaseInteraction.GetDisplayName();
                        int    cost         = purchaseInteraction.cost;
                        string boxText      = $"{friendlyName}\n${cost}\n{distance}m";
                        GUI.Label(new Rect(BoundingVector.x - 50f, (float)Screen.height - BoundingVector.y, 100f, 50f), boxText, Main.renderInteractablesStyle);
                    }
                }
            }
        }
Example #2
0
 private static void RenderInteractables()
 {
     foreach (PurchaseInteraction purchaseInteraction in PurchaseInteraction.FindObjectsOfType(typeof(PurchaseInteraction)))
     {
         if (purchaseInteraction.available)
         {
             Vector3 Position       = Camera.main.WorldToScreenPoint(purchaseInteraction.transform.position);
             var     BoundingVector = new Vector3(Position.x, Position.y, Position.z);
             if (BoundingVector.z > 0.01)
             {
                 GUI.color = Color.green;
                 String friendlyName = purchaseInteraction.GetDisplayName();
                 int    cost         = purchaseInteraction.cost;
                 string boxText      = $"{friendlyName}\n${cost}m";
                 GUI.Label(new Rect(BoundingVector.x - 50f, (float)Screen.height - BoundingVector.y, 100f, 50f), boxText);
             }
         }
     }
 }