Esempio n. 1
0
        public bool RequestOwnership(GameObject obj)
        {
            OwnableObject ownershipManager = obj.GetComponent <OwnableObject>();

            if (ownershipManager != null)
            {
                return(ownershipManager.Take());
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool Destroy(GameObject go)
        {
            if (go == null)
            {
                return(true);
            }
            else
            {
                OwnableObject ownershipManager = go.GetComponent <OwnableObject>();
                if (ownershipManager.Take())
                {
                    UnityEngine.GameObject.Destroy(go);
                    // Calling Unity's Destroy mechanism kills the object by triggering an OnDestroy call in the ObjectManager
                }

                return(true);
            }
        }