private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Exemplo n.º 2
0
		private static void AddButtonGroup(ElectricalManager electricalManager)
		{
			EditorGUILayout.BeginHorizontal();

			GUI.enabled = Application.isPlaying && electricalManager.Mode != ElectricalMode.Manual;

			if (GUILayout.Button("SetSpeed"))
			{
				ElectricalManager.SetInternalSpeed();
			}

			if (!electricalManager.Running)
			{
				if (GUILayout.Button("Start"))
				{
					electricalManager.StartSim();
				}
			}
			else if (GUILayout.Button("Stop"))
			{
				electricalManager.StopSim();
			}

			GUI.enabled = Application.isPlaying && !electricalManager.Running;

			if (GUILayout.Button("Step"))
			{
				ElectricalManager.Instance.electricalSync.RunStep(false);
			}

			GUI.enabled = true;

			EditorGUILayout.EndHorizontal();
		}
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Update()
 {
     if (Application.isPlaying == false)
     {
         if (ElectricalManager == null)
         {
             ElectricalManager = FindObjectOfType <ElectricalManager>();
         }
     }
 }
Exemplo n.º 4
0
		public override void OnInspectorGUI()
		{
			ElectricalManager electricalManager = (ElectricalManager)target;

			GUIContent speedContent = new GUIContent("Speed", "frequency of Atmos simulation updates (Millieseconds between each update)");

			electricalManager.MSSpeed = EditorGUILayout.Slider(speedContent, electricalManager.MSSpeed, 0, 5000);

			AddButtonGroup(electricalManager);

			DrawDefaultInspector();
		}
Exemplo n.º 5
0
        // Start is called before the first frame update
        void Update()
        {
            if (Application.isPlaying == false)
            {
                if (ElectricalManager == null)
                {
                    ElectricalManager = FindObjectOfType <ElectricalManager>();
                }

                if (ElectricalManager.DOCheck)
                {
                    //Logger.Log("Seting cables!");
                    var thing = GetComponent <CableInheritance>();
                    thing.ConvertToTile(true);
                    //ElectricalManager.DOCheck = false;

                    /*Logger.Log("Cleaning cables!");
                     * var ElectricalOI = this.GetComponent<ElectricalOIinheritance>();
                     * if (bigDict.ContainsKey(this.transform.localPosition))
                     * {
                     *
                     *      foreach (var con in bigDict[this.transform.localPosition])
                     *      {
                     *              if (ElectricalOI != con)
                     *              {
                     *                      if ((ElectricalOI.InData.WireEndA == con.InData.WireEndA && ElectricalOI.InData.WireEndB == con.InData.WireEndB) ||
                     *                              (ElectricalOI.InData.WireEndA == con.InData.WireEndB && ElectricalOI.InData.WireEndB == con.InData.WireEndA))
                     *                      {
                     *                              DestroyImmediate(gameObject);
                     *                              return;
                     *                      }
                     *
                     *              }
                     *      }
                     *      bigDict[this.transform.localPosition].Add(ElectricalOI);
                     * }
                     * else {
                     *      bigDict[this.transform.localPosition] = new HashSet<ElectricalOIinheritance>();
                     *      bigDict[this.transform.localPosition].Add(ElectricalOI);
                     * }*/
                }
            }
        }