예제 #1
0
 /// <summary>
 /// Links the gizmo to a GameObject such that when said object is destroyed the gizmo wil lalso be destroyed
 /// </summary>
 public void DeathLink(GameObject gm)
 {
     if (deathScript != null)
     {
         deathScript.onDeath -= Dispose;
     }
     (deathScript = gm.AddOrGetComponent <onDeathEvent>()).onDeath += Dispose;
 }
예제 #2
0
        /// <summary>
        /// Parents the gizmo to a Transform and links the gizmo to the transform's GameObject such that when the object is destroyed the gizmo will be destroyed also.
        /// </summary>
        public void SetParent(Transform trans)
        {
            gameObject.transform.SetParent(trans, false);
            var gm = trans.gameObject;

            if (gm != null)
            {
                if (deathScript != null)
                {
                    deathScript.onDeath -= Dispose;
                }
                (deathScript = gm.AddOrGetComponent <onDeathEvent>()).onDeath += Dispose;
            }
        }