예제 #1
0
    // static bool zeroglaged; //todo: temporary
    static bool RegisterID(ulong id, ObjectID objectID)
    {
        if (id == 0)
        {
            // if (!zeroglaged)
            {
                Debug.Log("zero id", objectID);
                // zeroglaged = true;
            }
            return(false);
        }

        if (identifierList == null || objectDict == null)
        {
            objectDict     = new Dictionary <ulong, GameObject>();
            identifierList = new List <ulong>();
        }
        if (objectDict.ContainsKey(id))
        {
            if (objectDict[id] == objectID.gameObject)
            {
                return(true);
            }
            // Debug.Log($" key {id} was present was pointintg at a diffent obejct '{ objectID.name}' other was '{ objectDict[id].NameOrNull()}'", objectID);
            return(false);
        }
        identifierList.Add(id);
        objectDict.Add(id, objectID.gameObject);
        objectID.ConfirmID(id);

        return(true);
    }