public void SetAttackUI(int code) { uicon.UIOnOff(code); switch (code) { case 0: attackButton = uicon.UI_Melee.GetComponent <AttackButton>(); ((MeleeAttackButton)attackButton).isSpear = false; break; case 1: attackButton = uicon.UI_Melee.GetComponent <AttackButton>(); ((MeleeAttackButton)attackButton).isSpear = true; break; case 2: attackButton = uicon.UI_Distance.GetComponent <AttackButton>(); break; } }