using UnityEngine;
using System.Collections;

public class AlartScript : MonoBehaviour {

    SpriteRenderer m_sr;

    public Sprite[] alartSprites;
    private int iAlartIdx;
    private float fTimer;

	// Use this for initialization
	void Start ()
	{
	    m_sr = GetComponent<SpriteRenderer>();
	    fTimer = 0.1f;
	}
	
	// Update is called once per frame
    private void Update()
    {
        fTimer -= Time.deltaTime;
        if (fTimer < 0.0f)
        {
            fTimer += 0.1f;
            iAlartIdx++;
            if (iAlartIdx >= alartSprites.Length)
                iAlartIdx = 0;

            m_sr.sprite = alartSprites[iAlartIdx];
        }

	}
}
