public void SetupFish(int id, Constants.FishState state, ProfileExtension extension, GameUI gameUI = null) { var fish = Instantiate(glanceFishPrefab, gameObject.transform); fish.GetComponent <Transform>().localPosition = new Vector3((id % 4 - 1.5f) * hDist, (1 - id / 4) * vDist - vBias); fish.SetupFish(id, state, extension); fish.detailed = gameUI != null; if (!gameUI) { return; } var fishTrigger = new EventTrigger.Entry(); fishTrigger.callback.AddListener(delegate { gameUI.GameState.AssertionTarget = id; gameUI.CloseAssertionModal(); gameUI.doNotAssertButton.SetActive(false); gameUI.assertionButtons[gameUI.GameState.Assertion].SetActive(false); gameUI.ChangeStatus(); }); fish.fishAvatar.GetComponent <EventTrigger>().triggers.Add(fishTrigger); }
public void SetupFish(int id, Constants.FishState state, ProfileExtension extension) { fishAvatar.overrideSprite = SharedRefs.FishAvatars[id]; switch (state) { case Constants.FishState.Used: mask.color = new Color(1, 0, 0, 0.3f); border.color = Color.grey; break; case Constants.FishState.Using: mask.color = new Color(0, 0, 0, 0); border.color = Color.white; break; case Constants.FishState.Free: mask.color = new Color(0, 0, 0, 0.6f); border.color = new Color(0, 128, 0, 0.6f); break; default: throw new ArgumentOutOfRangeException(nameof(state), state, null); } _extension = extension; _id = id; }