Пример #1
0
    // Use this for initialization
    private void Start()
    {
        // Get input asset
        inputs = TDS_GameManager.InputsAsset;

        foreach (TDS_Controller _controller in TDS_GameManager.InputsAsset.Controllers)
        {
            SubscribeController(_controller);
        }
    }
Пример #2
0
    public static void CreateInputAsset()
    {
        // If an input asset already exist, just return
        if (Resources.Load(INPUT_ASSET_PATH) != null)
        {
            return;
        }

        TDS_InputSO _inputAsset = CreateInstance <TDS_InputSO>();

        System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Application.dataPath, "Resources", System.IO.Path.GetDirectoryName(INPUT_ASSET_PATH)));

        AssetDatabase.CreateAsset(_inputAsset, System.IO.Path.Combine("Assets/Resources", INPUT_ASSET_PATH) + ".asset");
        AssetDatabase.SaveAssets();
    }
Пример #3
0
    public static void CreateController()
    {
        TDS_InputSO _inputs = Resources.Load <TDS_InputSO>(INPUT_ASSET_PATH);

        if (!_inputs)
        {
            CreateInputAsset();
            _inputs = Resources.Load <TDS_InputSO>(INPUT_ASSET_PATH);
        }

        TDS_Controller[] _newControllers = new TDS_Controller[_inputs.Controllers.Length + 1];

        for (int _i = 0; _i < _newControllers.Length - 1; _i++)
        {
            _newControllers[_i] = _inputs.Controllers[_i];
        }

        _newControllers[_newControllers.Length - 1] = new TDS_Controller();
        _inputs.Controllers = _newControllers;
    }