public virtual void Initialize(MusicLevelEditor editor, LR_MusicLevelSetup setup) { CM_Debug.Log("Beat Item UI", "Initializing start at " + this); musicLevelEditor = editor; musicLevelSetup = setup; CM_Debug.Log("Beat Item UI", "Initializing finish at " + this); }
public void Shoot(GameObject projectile, float force, float spray, float damage) { // Projectile stats CM_Debug.Log("CM.Shooting", "Shooting a Projectile at " + this + "." + " [Projectile: " + projectile + "]" + " [Force: " + force + "]" + " [Spray: " + spray + "]" ); // Return if shootTransform is null if (!_shootTransform) { CM_Debug.LogWarning("CM.Shooting", this + " has no reference to a Shoot Transform."); return; } projectile.transform.position = _shootTransform.position; projectile.transform.rotation = _shootTransform.rotation; // Spray if (spray > 0) { projectile.transform.rotation = Quaternion.Euler(new Vector3(projectile.transform.eulerAngles.x, projectile.transform.eulerAngles.y, projectile.transform.eulerAngles.z + Random.Range(-spray, spray))); } Rigidbody2D projectileRigidbody2D = projectile.GetComponent <Rigidbody2D>(); // Return if the Projectile has no Rigidbody2D if (!projectileRigidbody2D) { CM_Debug.LogWarning("CM.Shooting", "There is no Rigidbody2D attached to " + projectile + "."); return; } projectileRigidbody2D.AddForce(projectile.transform.right * force); }
public void Activate() { CM_Debug.Log("Beat Item UI", "Activating at " + this); _wallsUIActivation.SetActive(false); }
public void AddInterface(T newInterface) { interfaces.Add(newInterface); CM_Debug.Log("CM", "CM.Essentials.Manager", "Added an interface of type " + typeof(T) + " to " + this + ". This Manager now has a total of " + interfaces.Count + " interfaces"); }
public virtual void Remove() { musicLevelEditor.UpdateIndex(); CM_Debug.Log("Beat Item UI", "Removing at " + this); }
public virtual void Preset(int beatIndex) { CM_Debug.Log("Beat Item UI", "Presetting at " + this); }
public virtual void Apply() { CM_Debug.Log("Beat Item UI", "Applying at " + this); musicLevelEditor.UpdateIndex(); }
public virtual void Activate() { activationUI.SetActive(false); CM_Debug.Log("Beat Item UI", "Activating at " + this); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // Get the target entity Entity entity = (Entity)target; // Only run if there are modules created if (entity.ModuleInterfaces.Length == 0) { entity.InitializeModules(); return; } // Found Modules List <Component> modules = new List <Component>(); for (int i = 0; i < entity.ModuleInterfaces.Length; i++) { Component[] tmpModules = entity.GetModules(entity.ModuleInterfaces[i], true); foreach (Component module in tmpModules) { // Not including duplicates if (!modules.Contains(module)) { modules.Add(module); } } } // Display a Label with: "Modules Found (modulesFoundNumber)" GUILayout.Label("Modules Found " + "(" + modules.Count + ")", EditorStyles.boldLabel); for (int i = 0; i < modules.Count; i++) { if (_moduleFoldouts.Length != modules.Count) { _moduleFoldouts = new bool[modules.Count]; } Editor tmpEditor = CreateEditor(modules[i]); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.BeginHorizontal(); // Foldouts GUIStyle foldoutStyle = new GUIStyle() { fontStyle = FontStyle.Bold, stretchWidth = true, stretchHeight = false, alignment = TextAnchor.MiddleLeft, margin = new RectOffset(20, 0, 0, 0) }; _moduleFoldouts[i] = EditorGUILayout.Foldout(_moduleFoldouts[i], modules[i].ToString(), true, foldoutStyle); // Module activate GameObject checkbox if (modules[i].gameObject.name != "Modules") { modules[i].gameObject.SetActive(EditorGUILayout.Toggle(modules[i].gameObject.activeInHierarchy, GUILayout.ExpandWidth(true), GUILayout.Width(20), GUILayout.Height(20))); } EditorGUILayout.EndHorizontal(); if (_moduleFoldouts[i]) { EditorGUILayout.BeginVertical("Box"); tmpEditor.OnInspectorGUI(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } EditorGUILayout.BeginHorizontal("Box"); // Open all foldouts if (GUILayout.Button("Open All")) { CM_Debug.Log("Opening all foldouts", "CM", "CM.Entity"); for (int i = 0; i < _moduleFoldouts.Length; i++) { _moduleFoldouts[i] = true; } } // Close all foldouts if (GUILayout.Button("Close All")) { CM_Debug.Log("Closing all foldouts", "CM", "CM.Entity"); for (int i = 0; i < _moduleFoldouts.Length; i++) { _moduleFoldouts[i] = false; } } // Activate all Modules if (GUILayout.Button("Activate All")) { CM_Debug.Log("Activating all Modules", "CM", "CM.Entity"); entity.ActivateAllModules(); } // Deactivate all Modules if (GUILayout.Button("Deactivate All")) { CM_Debug.Log("Deactivating all Modules", "CM", "CM.Entity"); entity.DeactivateAllModules(); } EditorGUILayout.EndHorizontal(); }
public void Shoot(float force, float spray, float damage) { CM_Debug.Log("CM.Shooting", "Use " + this + ".Shoot(projectile, force, spray) instead of " + this + ".Shoot(force, spray, damage). The " + this + " class requires a (GameObject)projectile."); return; }
public void Shoot() { CM_Debug.Log("CM.Shooting", "You can't call the Shoot method directly, use " + this + ".Trigger() instead"); }