import { ITrackEntry } from 'pixi-spine';
import { CanBeBlocked, CanPlayBouncing, CanPlayFalling, CanPlayIdle, CanPlayWin } from '../types/Entity';
import Symbol from './Symbol';

export default class CascadeSymbol extends Symbol implements
  CanPlayIdle, CanPlayBouncing, CanBeBlocked, CanPlayWin, CanPlayFalling
{
    public isBlocked: boolean = false;

    /**
     * Triggers the idle animation for the symbol and returns track entry.
     * @returns A function to check the animation progress.
     */
    idle(): ITrackEntry
    {
        return this.spine.state.setAnimation(0, 'idle', false);
    }

    /**
     * Triggers the bounce animation and returns track entry.
     * @returns A function to check the animation progress.
     */
    bounce(): ITrackEntry
    {
        return this.spine.state.setAnimation(0, 'bounce', false);
    }

    /**
     * Triggers the win animation and returns track entry.
     * @returns A function to check the animation progress.
     */
    win(): ITrackEntry
    {
        return this.spine.state.setAnimation(0, 'win', false);
    }

    /**
     * Triggers the falling animation and returns track entry.
     * @returns A function to check the animation progress.
     */
    falling(): ITrackEntry
    {
        return this.spine.state.setAnimation(0, 'falling', false);
    }
}
