private void Awake() { allCharacters = BasicCharacterControler.FindObjectsOfType <BasicCharacterControler>(); //Set all characters to false for (int i = 0; i < allCharacters.Length; i++) { allCharacters[i].SetIsActive(false); } //Set active character on allCharacters[0].SetIsActive(true); selectedCharacter = allCharacters[index]; }
public void SwitchCharacter(int indx) { //put index back into the array if needed if (indx >= allCharacters.Length) { index = 0; } else if (indx < 0) { index = allCharacters.Length - 1; } //Set all characters to false for (int i = 0; i < allCharacters.Length; i++) { allCharacters[i].SetIsActive(false); } //Set active character on allCharacters[index].SetIsActive(true); selectedCharacter = allCharacters[index]; }
// Start is called before the first frame update void Start() { jebseeController = gameObject.GetComponent <BasicCharacterControler>(); body = GetComponent <Rigidbody2D>(); dashDirection = DashDirection.NoDirection; }