public void Swap() { if (!_support.Character.IsDead) { // Interrupt actions in progress _main.InterruptAnimateAction(); _support.InterruptAnimateAction(); // Swap characters CombatCharacterScript temp = _main; _main = _support; _support = temp; // Move character figures _support.GetComponent <CharacterMoverScript>().GoToSupportPosition(); _main.GetComponent <CharacterMoverScript>().GoToMainPosition(); // Update action bar TeamActionBar actionBar = GetComponent <TeamActionBar>(); if (actionBar != null) { actionBar.UpdateButtons(_main.Character, _support.Character); } } }
void Awake() { TeamActionBar actionBar = GetComponent <TeamActionBar>(); if (actionBar != null) { actionBar.UpdateButtons(_main.Character, _support.Character); } _main.Character.OnDeath.AddListener(SwapOnDeath); _support.Character.OnDeath.AddListener(SwapOnDeath); _main.GetComponent <CharacterMoverScript>().GoToMainPosition(); _support.GetComponent <CharacterMoverScript>().GoToSupportPosition(); }