using UnityEngine;
using System.Collections;

public class Bloc : MonoBehaviour {

	public enum BLOC_TYPE
    {
        INVALID,
        _SPACE,
        X_STANDARD,
        START,
        END,
        KILL,
        BUMP,
        INTERRUPTEUR1,
        INTERRUPTEUR2,
        INTERRUPTEUR3,
        INTERRUPTEUR4,
        ROTATING,
        LEFTPUSH,
        RIGHTPUSH,
        PISTON,
        TDFW,
        CHECKPOINT
    }

    public BLOC_TYPE type;
    public string typeChar = "A";
    public Color col;
    bool destroyRequest = false;
    Vector3 deplacement = Vector3.zero;

    public void DoAction()
    {
        
        switch (this.type)
        {
            case BLOC_TYPE.END:
                {
                    Game.instance.Victory();
                    break;
                }
            case BLOC_TYPE.KILL:
                {
                    Game.instance.Fail();
                    break;
                }
            case BLOC_TYPE.BUMP:
                {
                    if (Game.instance.herosScript != null)
                    {
                        Game.instance.herosScript.Jump();
                    }
                    else Debug.Log("No hero script");
                    break;
                }
            case BLOC_TYPE.INTERRUPTEUR1:
                {
                    Game.instance.DestroyNumber(1);
                    Game.instance.DestroyNumber(2);
                    break;
                }
            case BLOC_TYPE.INTERRUPTEUR3:
                {
                    Game.instance.DestroyNumber(3);
                    Game.instance.DestroyNumber(4);
                    break;
                }
            case BLOC_TYPE.LEFTPUSH:
                {
                    Game.instance.herosScript.PushLeft();
                    break;
                }
            case BLOC_TYPE.RIGHTPUSH:
                {
                    Game.instance.herosScript.PushRight();
                    break;
                }
            case BLOC_TYPE.TDFW:
                {
                    StartCoroutine(Game.instance.TurnDownForWhat());
                    break;
                }


        }
        

    }
}
