public void Interact(SwitchElement switcher) // Main goal of SwitchMechanism { var toInteract = Elements.Where(x => x != GetLinked(switcher) && x.gameObject.active); foreach (var g in toInteract) { g.gameObject.SetActive(false); //Activation of rest } GetLinked(switcher).gameObject.SetActive(true); //TheElemnt what you are interacting //switcher.gameObject.SetActive(false); }
public SwitchElementTarget GetLinked(SwitchElement switcher) //Get SwtichElementTarget { return(Buttons[switcher]); }
public List <Link> Links; //All Links public void AddLink(SwitchElement switcher, SwitchElementTarget target) //Register in to Dictionary { Buttons.Add(switcher, target); Elements.Add(target); }