using UnityEngine;
using System.Collections;

public class FamilyScript : MonoBehaviour {

	public float timer = 0f;
	public int blink = 0;
	public Sprite orig;
	public Sprite blink1;
	public Sprite blink2;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
		timer += Time.deltaTime;

		if (timer >= 1.1f && blink == 0) {
			blink = Random.Range(1,3);
		}
		if (timer >= 1.3f) {
			blink = 0;
			timer = 0f;
		}

		if (blink == 1) {
			GetComponent<SpriteRenderer>().sprite = blink1;
		}
		if (blink == 2) {
			GetComponent<SpriteRenderer>().sprite = blink2;
		}
		if (blink == 0) {
			GetComponent<SpriteRenderer>().sprite = orig;
		}
	}
}
