コード例 #1
0
    private void Awake()
    {
        _mainView = _boostCardPrefab.GetComponent <BoostCardView>();
        _boostCardPrefab.transform.SetAsFirstSibling();
        _boostCardPrefab.transform.localPosition = Vector3.zero;
        _boostCardPrefab.gameObject.SetActive(false);

        _mainButton = _boostCardPrefab.GetComponent <Button>();
        _mainButton.onClick.AddListener(_player.StartBoostRoutine);
        if (!_interactable)
        {
            SetNotInteractable(_mainButton);
        }

        // sets animation object and disables button - TODO this could be simplified with a simple visual prefab
        _animView = Instantiate(_boostCardPrefab, transform);
        SetNotInteractable(_animView.GetComponent <Button>());

        _animView.transform.SetAsFirstSibling();
        _animView.transform.position = _boostCardPrefab.transform.position;
        _animView.gameObject.SetActive(false);

        _lastCard = new BoostCard(null);
    }
コード例 #2
0
 private void Awake()
 {
     _view = GetComponent <BoostCardView>();
 }