Beispiel #1
0
        public void CancelIncubation()
        {
            // Assert.IsNotNull(incubated, "nothing incubated");
            if (incubated != null)
            {
                incubator.UnincubateAndDestroy();
                initiator.ShowButtons(true);

                incubated = null;
                OnUnincubated?.Invoke();
                GetComponent <Animator>().SetTrigger("Unincubate");
            }
        }
Beispiel #2
0
        private void SpawnIncubated()
        {
            Assert.IsNotNull(incubated, "nothing incubated to spawn");
            incubator.UnincubateAndRelease();
            OnUnincubated?.Invoke();

            SpawnWithNonUserEvents(incubated);
            int spawnedIdx = incubated.Idx;

            incubated = null;
            initiator.ShowButtons(true);

            OnUserSpawned?.Invoke(spawnedIdx);

            // this *should* also be handled by a nodelink callback anyway
            InspectSpecies(spawnedIdx);
        }
Beispiel #3
0
        //////////////////
        // public stuff //
        //////////////////
        public void InspectSpecies(int idx)
        {
            if (inspected == null)
            {
                GetComponent <Animator>().SetTrigger("Inspect");
            }
            if (incubated != null)
            {
                incubator.UnincubateAndDestroy();
                initiator.ShowButtons(true);

                incubated = null;
                OnUnincubated?.Invoke();
            }

            inspected = spawnedSpecies[idx];
            nameField.SetNameWithoutCallback(inspected.GObject.name);
            if (inspected.UserName != null)
            {
                nameField.SetUserColour();
            }
            else
            {
                nameField.SetDefaultColour();
            }
            sizeTrait.SetValueWithoutCallback(inspected.BodySize);
            greedTrait.SetValueWithoutCallback(inspected.Greediness);

            // if (inspected.SizeEditable && !)
            sizeTrait.Interactable     = inspected.SizeEditable;
            greedTrait.Interactable    = inspected.GreedEditable;
            refroveButton.interactable = inspected.Removable;

            refroveButton.gameObject.SetActive(!removeHidden);
            refroveButton.onClick.RemoveAllListeners();
            refroveButton.onClick.AddListener(RemoveInspected);

            nameField.ExpandIntoRefrove(removeHidden); // uuggghhh
        }