public override void Update() { if (Input.GetButtonDown("deselect_object") || !this.GuiController.GuiInfo.Player.ManaStorage.CheckMana(this.gameCard.ManaCost)) { this.cardobj.renderer.material.color = Color.white; RestoreColor(); this.Finished = true; return; } var objs = this.GuiController.GetGameObjectsOnMouse().Where(gobj => !this.targets[targetIndex].ContainsKey(gobj)); GameObject newSelected = null; foreach (GameObject gobj in objs) { if (gobj == currentSelected) { newSelected = currentSelected; break; } var modelobj = this.GuiController.GetModelObjectsFromGameObjects(gobj); if (gameCard.TestTarget(targetIndex, modelobj)) { newSelected = gobj; modelSelected = modelobj; selectedAccepted = true; break; } } if (newSelected == null) { newSelected = objs.FirstOrDefault(); modelSelected = null; selectedAccepted = false; } if (selectedAccepted && Input.GetButtonDown("select_object")) { RestoreColor(); selectObject(newSelected, modelSelected); return; } if (newSelected == currentSelected) { return; } RestoreColor(); if (newSelected == null) { return; } this.formerSelectedsColor = newSelected.renderer.material.color; if (this.selectedAccepted) { newSelected.renderer.material.color = Color.yellow; } else { newSelected.renderer.material.color = Color.red; } this.currentSelected = newSelected; }