public static PiecesConstructor instance()
    {
        if (_instance != null)
        {
            return(_instance);
        }

        _instance = FindObjectOfType <PiecesConstructor>();

        if (_instance == null)
        {
            GameObject resourceObject = Resources.Load <GameObject>("PiecesConstructor");
            if (resourceObject != null)
            {
                GameObject instanceObject = Instantiate(resourceObject);
                _instance = instanceObject.GetComponent <PiecesConstructor>();
                DontDestroyOnLoad(instanceObject);
            }
            else
            {
                Debug.Log("Resource does not have a definition for PiecesContructor");
            }
        }
        return(_instance);
    }
示例#2
0
 private void Awake()
 {
     pieceConstructor = PiecesConstructor.instance();
     playableArea     = new List <List <BoardPiece> >();
 }