using UnityEngine;
using System.Collections;

public class Alternador : MonoBehaviour {
	public GameObject[] personagens = new GameObject[3];
	public int i = 0;

	// Use this for initialization
	void Start () {
		for(int i = 0; i < 3; i++) {
			personagens[i] = transform.GetChild(i).gameObject;
			if(i == 0) continue;
			personagens[i].GetComponent<Movimentacao>().Desativa();
		}
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.C)) {
			personagens[i].SendMessage("Desativa");
			i = (i + 1) % personagens.Length;
			personagens[i].SendMessage("Ativa");

		}
	}
}
