コード例 #1
0
    public MBDOInitializationHelper(MonoBehaviour callerAkaThis)
    {
        isSetup                    = false;
        cardinalSubsystem          = null;
        mbDatabaseObjectReferences = null;
        caller = callerAkaThis;

        Setup(callerAkaThis);
    }
コード例 #2
0
    public MBDOInitializationHelper(MonoBehaviour callerAkaThis)
    {
        isSetup     = default;
        CardinalObj = default;
        mbDatabaseObjectReferences = default;
        caller     = default;
        isCardinal = default;

        SetupCardinalSubSystem(callerAkaThis);
    }
コード例 #3
0
    public virtual void OnValidate()
    {
        if (Application.isEditor)
        {
            MBDataObjectReferences mbdoRefs = GetComponent <MBDataObjectReferences>();
            if (mbdoRefs != null && mbdoRefs.mbDataObjects.Contains(this) != true)
            {
                Debug.LogWarning($"Warning: {this} has not been added to {mbdoRefs}, adding now...");
                mbdoRefs.mbDataObjects.Add(this);
#if UNITY_EDITOR
                UnityEditor.EditorUtility.SetDirty(this);
                UnityEditor.EditorUtility.SetDirty(mbdoRefs);
#endif
            }
        }
    }
コード例 #4
0
    public void Setup(MonoBehaviour callerAkaThis)
    {
        isSetup                    = true;
        cardinalSubsystem          = null;
        mbDatabaseObjectReferences = null;
        caller = callerAkaThis;

        cardinalSubsystem = GameObject.Find("Cardinal Subsystem");
        if (cardinalSubsystem != null)
        {
            mbDatabaseObjectReferences = cardinalSubsystem.GetComponent <MBDataObjectReferences>();
            if (mbDatabaseObjectReferences == null)
            {
                //Debug.Log("mbDatabaseObjectReferences not found in " + cardinalSubsystem);
            }
        }
        else
        {
            //Debug.Log("Cardinal Subsystem not found in " + this);
        }
    }
コード例 #5
0
    public void SetupCardinalSubSystem(MonoBehaviour callerAkaThis)
    {
        isSetup     = false;
        CardinalObj = null;
        mbDatabaseObjectReferences = null;
        caller = null;
        if (callerAkaThis.gameObject.scene != new Scene())
        {
            isCardinal = false;
            isSetup    = true;
            caller     = callerAkaThis;

            GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Cardinal Subsystem");

            foreach (GameObject go in gameObjects)
            {
                if (go.scene == caller.gameObject.scene && go.scene != new Scene())
                {
                    CardinalObj = go;
                }
            }
            //cardinalSubsystem = GameObject.Find("Cardinal Subsystem");


            if (CardinalObj != null)
            {
                mbDatabaseObjectReferences = CardinalObj.GetComponent <MBDataObjectReferences>();
                if (mbDatabaseObjectReferences == null)
                {
                    Debug.Log("mbDatabaseObjectReferences not found in " + CardinalObj);
                }
            }
            else
            {
                Debug.Log("Cardinal Subsystem not found in " + caller + "'s scene: " + caller.gameObject.scene.name);
            }
        }
    }