Example #1
0
    public void Init(BallCanvas ballCanvas, SwipeHelper swipeHelper, BoxCollider goalTrigger, Camera mainCamera)
    {
        this.swipeHelper = swipeHelper;
        this.goalTrigger = goalTrigger;
        this.mainCamera  = mainCamera;

        ballRigidbody = GetComponent <Rigidbody>();
        meshRenderer  = GetComponent <MeshRenderer>();

        swipeHelper.OnSwipe   += Shoot;
        swipeHelper.OnRelease += ReleaseBall;

        this.ballCanvas = ballCanvas;
        ballCanvas.Init(this);
        ballCanvas.Activate();
        ballCanvas.OnSelect += SetBallHeld;

        obstacleLayer = LayerMask.NameToLayer(obstacleLayerName);
    }
Example #2
0
    void Start()
    {
        swipe = new SwipeHelper();

        Button button = this.GetComponent <Button>();

        if (button != null)
        {
            button.onClick.AddListener(OnButtonClicked);
        }


        if (_initialColorsSet)
        {
            return;
        }

        _initialColorsSet = true;
        if (UiTextItem != null)
        {
            UiTextItem.color = TextColor;
        }
    }
    void Start()
    {
        swipe = new SwipeHelper();

        Button button = this.GetComponent<Button>();
        if (button != null)
        {
            button.onClick.AddListener(OnButtonClicked);
        }

        if (_initialColorsSet)
            return;

        _initialColorsSet = true;
        if (UiTextItem != null)
        {
            UiTextItem.color = TextColor;
        }
    }