void spawny() { string poolName = randomizer.TakeOne(); GameObject enemie = GameObjectPool.Instance.Spawn(poolName, transform.position, Quaternion.identity); enemie.SendMessage("Reset", SendMessageOptions.DontRequireReceiver); Debug.Log("Spawning"); }
private GameObject GetNextPrefab() { if (AllTheDialogue.Options.ContainsKey(_linearRoomCount)) { var dialogRoom = Instantiate(DialogRoomPrefab, transform, false).GetComponent <Room>(); var entrance = dialogRoom.TransitionPoints.First(d => d.IsViableEntrance); entrance.EntryDialog = AllTheDialogue.Options[_linearRoomCount]; _linearRoomCount++; return(dialogRoom.gameObject); } else { var picked = _weights.TakeOne(); _weights.Weights[picked] = Mathf.RoundToInt(_weights.Weights[picked] * 0.8f); _linearRoomCount++; var ins = Instantiate(picked, transform, false); foreach (var spawner in ins._spawners) { spawner.ShouldSpawn = false; } return(ins.gameObject); } }
IEnumerator Spawn() { GameObject enemie = randomizer.TakeOne().Spawn(); enemie.SendMessage("Reset", SendMessageOptions.DontRequireReceiver); Debug.Log("Spawning"); yield return(new WaitForSeconds(spawnTime)); StartCoroutine(Spawn()); }
/// <summary> /// Instantiate the randomly choose ButtonGroup and subscribe to its event /// </summary> public void InstantiateButtonGroup() { Initialize(); if (_buttonGroupVisualInstance != null) { Destroy(_buttonGroupVisualInstance.gameObject); } #if VOODOO_SAUCE _buttonGroupData = enableSpecialButtonGroupDatas && weightedButtonGroupDatas.Count > 0 ? weightedButtonGroupDatas.TakeOne() : defaultButtonGroupData; #else _buttonGroupData = defaultButtonGroupData; #endif _buttonGroupVisualInstance = Instantiate(_buttonGroupData.buttonGroupVisualPrefab, parentButtonGroupVisual != null ? parentButtonGroupVisual : transform); _buttonGroupVisualInstance.DefaultButtonClicked.AddListener(ContinueButtonClickedInvoker); if (destroySpecialButtonOnClick) { _buttonGroupVisualInstance.SpecialButtonClicked.AddListener(DestroyButton); } }