public override void OnInspectorGUI() { DrawDefaultInspector(); if (SpriteCollection != null) { _interactiveObject.InteractSprite = SpriteCollection.Sprites[(int)_interactiveObject.Cursor]; } else { GUILayout.Label("Cannot find Cursor Sprites!!. Put SpriteCollection in Resources/Cursors.asset"); } GUILayout.Space(15); GUILayout.Label("Click to add component..."); if (_interactiveObject.InteractComponentsList != null) { foreach (var component in _interactiveObject.InteractComponentsList.MonoBehaviours) { if (component == null) { continue; } EditorGUI.BeginDisabledGroup(_interactiveObject.GetComponent(component.GetClass())); if (GUILayout.Button("Add " + component.name)) { _interactiveObject.gameObject.AddComponent(component.GetClass()); } EditorGUI.EndDisabledGroup(); } } }
public void DestroyIO(BaseInteractiveObject io) { if (io != null && io.Show != IoGlobals.SHOW_FLAG_DESTROYED) { ForceIOLeaveZone(io, 0); // if interactive object was being dragged // if (DRAGINTER == ioo) { // set drag object to null // Set_DragInter(NULL); // } // if interactive object was being hovered by mouse // if (FlyingOverIO == ioo) { // set hovered object to null // FlyingOverIO = NULL; // } // if interactive object was being combined // if (COMBINE == ioo) { // set combined object to null // COMBINE = NULL; // } if (io.HasIOFlag(IoGlobals.IO_02_ITEM) && io.ItemData.Count > 1) { io.ItemData.AdjustCount(-1); } else { // Kill all spells int numm = GetInterNum(io); if (HasIO(numm)) { // kill all spells from caster // ARX_SPELLS_FizzleAllSpellsFromCaster(numm); } // Need To Kill timers Script.Instance.TimerClearByIO(io); io.Show = IoGlobals.SHOW_FLAG_DESTROYED; io.RemoveGameFlag(IoGlobals.GFLAG_ISINTREATZONE); if (!FAST_RELEASE) { RemoveFromAllInventories(io); } // unlink from any other IOs // if (ioo->obj) { // EERIE_3DOBJ * eobj = ioo->obj; // while (eobj->nblinked) { // long k = 0; // if ((eobj->linked[k].lgroup != -1) // && eobj->linked[k].obj) { // INTERACTIVE_OBJ * iooo = // (INTERACTIVE_OBJ *)eobj->linked[k].io; // if ((iooo) && ValidIOAddress(iooo)) { // EERIE_LINKEDOBJ_UnLinkObjectFromObject( // ioo->obj, iooo->obj); // ARX_INTERACTIVE_DestroyIO(iooo); // } // } // } // } DestroyDynamicInfo(io); if (io.ScriptLoaded) { int num = GetInterNum(io); ReleaseIO(io); if (HasIO(num)) { GetIOs()[num] = null; } } } print("making call to destroy io now"); // detach the IO from its parent io.transform.parent = null; SpriteRenderer sr = io.GetComponent <SpriteRenderer>(); if (sr != null) { sr.sprite = null; Destroy(sr); } BoxCollider2D bc = io.GetComponent <BoxCollider2D>(); if (bc != null) { Destroy(bc); } Rigidbody2D rb = io.GetComponent <Rigidbody2D>(); if (rb != null) { Destroy(rb); } io.transform.position = new Vector3(-1, -1, 0); Destroy(io); } }