/// <summary>
        /// Shows the touch effect for the specified cursor.
        /// </summary>
        public void Show(ICursor cursor, IInputResultReporter resultReporter)
        {
            UnbindCursor();
            BindCursor(cursor, resultReporter);

            // Set initial position.
            Position = cursor.Position;

            showAni?.PlayFromStart();
        }
        /// <summary>
        /// Binds cursor and result reporter events and stores their reference.
        /// </summary>
        private void BindCursor(ICursor cursor, IInputResultReporter resultReporter)
        {
            this.cursor = cursor;
            cursor.State.Bind(OnCursorStateChange);

            this.resultReporter = resultReporter;
            if (resultReporter != null)
            {
                resultReporter.OnResult += OnInputResult;
            }
        }
        /// <summary>
        /// Unbinds cursor and result reporter events and removes references to them.
        /// </summary>
        private void UnbindCursor()
        {
            if (cursor != null)
            {
                cursor.State.Unbind(OnCursorStateChange);
            }
            cursor = null;

            if (resultReporter != null)
            {
                resultReporter.OnResult -= OnInputResult;
            }
            resultReporter = null;
        }
Example #4
0
        /// <summary>
        /// Shows the secondary effect for specified cursor.
        /// </summary>
        public void ShowSecondary(ICursor cursor, IInputResultReporter resultReporter)
        {
            var effect = secondaryRecycler.GetNext();

            effect.Show(cursor, resultReporter);
        }