void Spawn() { PrefabHolder prefabHolder = PrefabHolder.GetActive(); GameObject prefab = prefabHolder.prefab; int numberToSpawn = prefabHolder.numberToSpawn; float spawnAreaSize = prefabHolder.spawnAreaSize; float accelerationScaler = prefabHolder.accelerationScaler; Entity prefabEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefab, GameObjectConversionSettings.FromWorld(this.World, null)); EntityManager entityManager = this.World.EntityManager; Unity.Mathematics.Random rand = new Unity.Mathematics.Random(0x6E624EB7u); for (int i = 0; i < numberToSpawn; i++) { Entity instance = entityManager.Instantiate(prefabEntity); float randomAngle = rand.NextFloat(); float randomRadius = rand.NextFloat(); float2 pointOnCircle = GetPointOnCircle(randomAngle) * randomRadius; float3 randFloat3 = new float3(pointOnCircle.x, 0, pointOnCircle.y) * spawnAreaSize; entityManager.SetComponentData(instance, new Translation { Value = randFloat3 }); entityManager.SetComponentData(instance, new Acceleration { Value = -randFloat3 * accelerationScaler }); } }
void Start() { center = GetComponent<BoxCollider2D>().offset; center.y = center.y + 2f; prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); attackTimer = new Timer(); }
void Start () { //loadStatsFromStatic (); slider.maxValue = healthMax; slider.value = health; prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); }
public void DoLocalSetups() { InitArtillery(); spawner = Pool.Instance; prefabHolder = PrefabHolder.Instance; RegistrPoolOfProjectiles(); }
// Use this for initialization void Awake() { ph = GameObject.FindGameObjectWithTag("PrefabHolder").GetComponent <PrefabHolder>(); activeMission = -1; ChosenHeroes = new List <Hero>(); ConfirmButton.SetActive(false); }
void Awake() { ph = GameObject.FindGameObjectWithTag("PrefabHolder").GetComponent <PrefabHolder>(); buttons = new List <Button>(); activeHero = -1; Cancel.onClick.AddListener(() => { activeHero = -1; Cancel.gameObject.SetActive(false); Confirm.gameObject.SetActive(false); UpdateDesc(null); }); Confirm.onClick.AddListener(() => { Debug.Log("Recruiting hero:"); AvailableHeroes[activeHero].Log(); player.RecruitHero(AvailableHeroes[activeHero]); AvailableHeroes.RemoveAt(activeHero); Destroy(buttons[activeHero].gameObject); buttons.RemoveAt(activeHero); for (int i = activeHero; i < buttons.Count; i++) { buttons[i].transform.localPosition = new Vector3(buttons[i].transform.localPosition.x, buttons[i].transform.localPosition.y + buttons[i].GetComponent <RectTransform>().rect.height + 2); } activeHero = -1; Cancel.gameObject.SetActive(false); Confirm.gameObject.SetActive(false); UpdateDesc(null); ReDisplayHeroRecruitment(); }); }
//Open up the menu that shows the possible prefabs public void OpenPrefabAdder() { GameObject go = Instantiate(addPrefabMenuPrefab); PrefabHolder pre = go.GetComponentInChildren <PrefabHolder>(); pre.tileProperties = this.GetComponent <TileProperties>(); }
private void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); return; } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); LoadGame(); prefabHolder = GetComponent <PrefabHolder>(); costHolder = GetComponent <UpgradeManager>(); }
public static PrefabHolder GetActive() { if (PrefabHolder.active == null) { PrefabHolder.active = UnityEngine.Object.FindObjectOfType <PrefabHolder>(); } return(PrefabHolder.active); }
public void RefreshHoldersList() { //if (m_characterHolder == null) //{ // m_characterHolder = new List<GameObject>(); //} //m_characterHolder.Clear(); m_entityHolderPrefab = GetEntityHolderAsset(); }
void OnLevelWasLoaded() { prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); if (NewGameOrLoad.LoadName != null) { Load(NewGameOrLoad.LoadName); NewGameOrLoad.LoadName = null; } }
public void BeforeTest() { prefabtHolder = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/Holder/PrefabHolder"), Vector3.zero, Quaternion.identity).GetComponent <PrefabHolder> (); GameObject gameObject = new GameObject(); gameObject.AddComponent <MapCreator> (); mapCreator = gameObject.GetComponent <MapCreator> (); mapCreator.CreateMap(rawMap, prefabtHolder.Tile); }
private PrefabHolder GetEntityHolderAsset() { AssetDatabase.Refresh(); PrefabHolder holderGameObject = AssetDatabase.LoadAssetAtPath <PrefabHolder>(m_holdersPath + "/Entity_Holder.prefab"); if (holderGameObject == null) { Debug.LogError("Cannot find Entity_Holder in: " + m_holdersPath + "/Entity_Holder.prefab"); } return(holderGameObject); }
private void Start() { mixer = PrefabHolder.MainMixer(); mixer.GetFloat("Volume", out volume); mixer.GetFloat("PlayerVolume", out playerVolume); mixer.GetFloat("AmbienceVolume", out ambienceVolume); mixer.GetFloat("StepsVolume", out stepsVolume); mixer.GetFloat("ObjectsVolume", out objectsVolume); mixer.GetFloat("EnemiesVolume", out enemiesVolume); }
private void Awake() { if (!Instance) { Instance = this; } else { Destroy(gameObject); } }
void Awake() { pool = PoolManager.instance; instance = this; pool.CreatePool(waveCircleCut, amount); pool.CreatePool(waveRectCut, amount); pool.CreatePool(waveCircle, amount); pool.CreatePool(waveRect, amount); pool.CreatePool(waveTri, amount); }
private void Awake() { if (m_myInstance == null) { m_myInstance = this; } else { Destroy(this); } }
public void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { //Debug.Log ("Scene Loaded"); if (gameState == GAMESTATE.Game) { prefabHolder = FindObjectOfType <PrefabHolder> (); puzzleManager = FindObjectOfType <PuzzleManager> (); InitLevel(GameConstants.GAMEPLAY); } else if (gameState == GAMESTATE.MainMenu) { InitLevel(GameConstants.MAINMENU); } }
void Start(){ Debug.Log ("START!"); canvas = GameObject.Find ("MerchantCanvas").GetComponent<Canvas> () as Canvas; room = GameObject.Find ("RoomManager").GetComponent<RoomManager>().roomToLoad; textButton1 = (Text)GameObject.Find ("TextItem1").GetComponent<Text>(); textButton2 = GameObject.Find ("TextItem2").GetComponent<Text>(); textButton3 = GameObject.Find ("TextItem3").GetComponent<Text>(); textButtonReload = GameObject.Find ("TextReload").GetComponent<Text>(); playerStats = GameObject.Find ("Player").GetComponent<BasicStats>() as BasicStats; prefabHolder = GameObject.Find ("PrefabHolder").GetComponent<PrefabHolder> (); itemHolder = GameObject.Find ("ItemHolder"); worldGenerator = GameObject.Find ("RoomManager").GetComponent<WorldGenerator> (); randItems = new int[3]; if (worldGenerator.merchantItems [room.x, room.y] == null) { Debug.Log ("nowy klient"); List<int> realItemPool = new List<int> (); realItemPool = Static.listDifference (room.itemPool, Static.itemsSpawned); for (int i = 0; i < randItems.GetLength(0); i++) { if (realItemPool.Count == 0) { randItems [i] = -1; continue; } randItems [i] = realItemPool [Static.randomIdxFromList<int> (realItemPool)]; realItemPool.Remove (randItems [i]); } worldGenerator.merchantItems [room.x, room.y] = new List<int> (); for(int i = 0; i < randItems.GetLength(0); i++){ worldGenerator.merchantItems [room.x, room.y].Add (randItems [i]); if(randItems[i] != -1) Static.itemsSpawned.Add (randItems[i]); } foreach(int x in worldGenerator.merchantItems[room.x, room.y]){ Debug.Log ("generated:" + x); } } else { Debug.Log("staly klient"); for(int i = 0; i < randItems.GetLength(0); i++) { randItems[i] = worldGenerator.merchantItems [room.x, room.y][i]; } foreach(int x in randItems){ Debug.Log ("Contains2: " + x); } } //Debug.Log ("wtf button names " + randItems[0]+" "+randItems[1]+" "+randItems[2]); //Debug.Log (Static.items [randItems [0]].name + " " + Static.items [randItems [1]].name + " " + Static.items [randItems [2]].name); //Debug.Log (Static.items [randItems [0]].cost + " " + Static.items [randItems [1]].cost + " " + Static.items [randItems [2]].cost); }
public void triggerBuff(BuffMode b) { if (currBuffProcess != null) { StopCoroutine(currBuffProcess); } debuff = b; GameObject explosionPrefab; bool parentToOther = false; if (!prefabHolder) { prefabHolder = FindObjectOfType <PrefabHolder>(); } switch (b) { case BuffMode.burn: explosionPrefab = prefabHolder.palletExplosionRed; parentToOther = true; currBuffProcess = burnDuration(); StartCoroutine(currBuffProcess); break; case BuffMode.freeze: explosionPrefab = prefabHolder.palletExplosionBlue; parentToOther = true; currBuffProcess = freezeDuration(); StartCoroutine(currBuffProcess); break; default: Debug.Log("buff case not recognized"); explosionPrefab = null; break; } GameObject effect = (explosionPrefab != null) ? Instantiate(explosionPrefab, transform.position, transform.rotation) : null; if (parentToOther) { effect.transform.parent = transform; } }
void Start() { userData = GlobalMethods.LoadUserDataFromFile(); fader = GetComponent <FaderEffect>(); fader.FadeIn(Color.black, 3); //resDropdown resolutions = Screen.resolutions; resDropdown.ClearOptions(); List <string> options = new List <string>(); int myResIndx = 0; foreach (Resolution r in resolutions) { if (r.Equals(Screen.currentResolution)) { myResIndx = options.Count; } options.Add(r.width + " x " + r.height); } resDropdown.AddOptions(options); resDropdown.value = myResIndx; resDropdown.RefreshShownValue(); //continue CheckIfShouldDisplayContinue(); //LevelSelection FindAviableLevels(); DisplayAviableLevles(); //cursor Cursor.visible = true; //mixer bugs PrefabHolder.MainMixer().ClearFloat("MasterLowPass"); PrefabHolder.MainMixer().ClearFloat("MasterPitch"); PrefabHolder.MainMixer().ClearFloat("MasterEcho"); }
protected override void OnCreate() { m_Group = GetEntityQuery(typeof(Translation), typeof(Speed), typeof(UpdateOrder)); GameObject prefab = PrefabHolder.GetActive().prefab; int numberToSpawn = PrefabHolder.GetActive().numberToSpawn; Entity prefabEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(prefab, GameObjectConversionSettings.FromWorld(this.World, null)); for (int i = 0; i < numberToSpawn; i++) { Entity entity = EntityManager.Instantiate(prefabEntity); UpdateOrder updateOrder = EntityManager.GetSharedComponentData <UpdateOrder>(entity); updateOrder.Value = i % updateFrequency; EntityManager.SetSharedComponentData(entity, updateOrder); } }
public override void OnInspectorGUI() { GUIStyle style = new GUIStyle(GUI.skin.button); style.normal.background = MakeTex(600, 1, new Color(0f, 0.5f, 0.1f, 0.5f)); PrefabHolder mytarget = (PrefabHolder)target; EditorGUILayout.LabelField("Prefab Holder Editor"); for (int i = 0; i < mytarget.m_poolDataList.Count; i++) { string name = "Not Assigned"; if (mytarget.m_poolDataList[i].m_obj) { name = mytarget.m_poolDataList[i].m_obj.name; } mytarget.m_poolDataList[i].m_foldOut = EditorGUILayout.Foldout(mytarget.m_poolDataList[i].m_foldOut, name); if (mytarget.m_poolDataList[i].m_foldOut) { EditorGUILayout.BeginVertical(style); EditorGUILayout.Separator(); mytarget.m_poolDataList[i].m_quantity = EditorGUILayout.IntField("Quantity", mytarget.m_poolDataList[i].m_quantity); mytarget.m_poolDataList[i].m_register = EditorGUILayout.Toggle("Register Prefab UNET", mytarget.m_poolDataList[i].m_register); mytarget.m_poolDataList[i].m_obj = EditorGUILayout.ObjectField("GameObject", mytarget.m_poolDataList[i].m_obj, typeof(GameObject), true) as GameObject; if (GUILayout.Button("Remove This")) { mytarget.m_poolDataList.RemoveAt(i); return; } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } } if (GUILayout.Button("Add New Object")) { mytarget.m_poolDataList.Add(new PoolData()); } EditorUtility.SetDirty(mytarget); }
void Awake () { Static.generateGlobalItemPool (); Random.seed = Static.randomSeed; rooms = new Room[width,height]; merchantItems = new List<int>[width,height]; dfsArray = new bool[width, height]; dfsArray[width / 2, height / 2] = true; edges = new List<Vector2>(); minimapPanel = GameObject.Find("MinimapPanel"); prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); for (int i = 0; i < width; i++) { for(int j = 0; j < height; j++){ rooms [i, j] = new Room (i, j, new Vector4(minX, maxX, minY, maxY), width, height); rooms[i, j].minimapImage = null; } } //Random.seed = -1402559560; Debug.Log ("WorldGenerator::Awake() seed=" + Random.seed); //Static.randomSeed = 1466330462; Debug.Log("Static::randomSeed " + Static.randomSeed); }
private void Update() { if (Storage.Energy == 0 && Time.timeSinceLevelLoad - timeStamp > coolDown) { isActive = true; Transform t = null; if (EnergyHandler.GetStrongestEnergyInCone(tip.position, Vector3.down, detectionRange, detectionBaseRadius, out t)) { if (!objectsShot.Contains(t)) { Instantiate(PrefabHolder.EnergyLaser(), laserTurretTipPosiiton.position, Quaternion.Euler(Vector3.right * 90f)); audioSource.clip = shootingSound; audioSource.Play(); animator.SetTrigger("Shoot"); objectsShot.Add(t); if (t != null) { var damageTaker = t.GetComponent <IGameObjectDamageTaker>(); if (damageTaker != null) { damageTaker.TakeDamage(); } } timeStamp = Time.timeSinceLevelLoad; } } } else { isActive = false; } if (isActive != visualizer.isVisible) { visualizer.UpdateVisibility(isActive); } }
void Start() { attackSpeed = new Timer(); prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); }
//Audio public void SetVolume(float volume) { PrefabHolder.MainMixer().SetFloat("Volume", volume); volumeText.GetComponent <Text>().text = (int)((volume + 80) * (1 / 0.8)) + "%"; }
private void Awake() { instance = this; prefabHolder = this.GetComponent <PrefabHolder>(); }
public void passReferences(PrefabHolder ph, GameControl gc) { prefabHolder = ph; gameControl = gc; }
private void CreateCharacter(string folderPath, PrefabHolder holder) { folderPath = "Assets" + folderPath; // CLIENT PREFAB GameObject clientTemp = new GameObject(); GameObject modelClient = CharacterEditorWindow.Instantiate(m_characterModel); modelClient.name = m_characterName + " - Idle"; modelClient.transform.SetParent(clientTemp.transform); clientTemp.name = "Entity_" + m_characterName + "Client"; clientTemp.layer = LayerMask.NameToLayer("Entity"); clientTemp.AddComponent <EntityCanvas>(); clientTemp.AddComponent <EntityBehaviour>(); NetworkIdentity networkIdentity = clientTemp.GetComponent <NetworkIdentity>(); BoxCollider boxColliderClient = clientTemp.AddComponent <BoxCollider>(); boxColliderClient.center = new Vector3(0, 0.5f, 0); boxColliderClient.size = new Vector3(0.5f, 1, 0.5f); boxColliderClient.isTrigger = true; var selectedLogicType = m_entityTypesLogics[m_entityLogicChoice]; System.Type logicType = CharacterEditorWindow.GetType(selectedLogicType); Logic logic = clientTemp.AddComponent(logicType) as Logic; logic.SetMobaEntity(clientTemp); networkIdentity.localPlayerAuthority = logic.IsLocalPlayerAuthority(); EntityTransform modelTransform = modelClient.AddComponent <EntityTransform>(); modelTransform.EntityTransformType = EEntityTransform.Model; GameObject transformLeftHandGOClient = new GameObject(); transformLeftHandGOClient.name = "Transform_" + EEntityTransform.LeftHand; EntityTransform leftHandTransformClient = transformLeftHandGOClient.AddComponent <EntityTransform>(); leftHandTransformClient.EntityTransformType = EEntityTransform.LeftHand; GameObject transformRightHandGOClient = new GameObject(); transformRightHandGOClient.name = "Transform_" + EEntityTransform.RightHand; EntityTransform rightHandTransformClient = transformRightHandGOClient.AddComponent <EntityTransform>(); rightHandTransformClient.EntityTransformType = EEntityTransform.RightHand; GameObject transformCenterGOClient = new GameObject(); transformCenterGOClient.name = "Transform_" + EEntityTransform.Center; EntityTransform centerTransformClient = transformCenterGOClient.AddComponent <EntityTransform>(); centerTransformClient.EntityTransformType = EEntityTransform.Center; GameObject transformCanvasGOClient = new GameObject(); transformCanvasGOClient.name = "Transform_" + EEntityTransform.Head; EntityTransform canvasTransformClient = transformCanvasGOClient.AddComponent <EntityTransform>(); canvasTransformClient.EntityTransformType = EEntityTransform.Head; GameObject transformFloorGOClient = new GameObject(); transformFloorGOClient.name = "Transform_" + EEntityTransform.Floor; EntityTransform floorTransformClient = transformFloorGOClient.AddComponent <EntityTransform>(); floorTransformClient.EntityTransformType = EEntityTransform.Floor; GameObject transformSkyGOClient = new GameObject(); transformSkyGOClient.name = "Transform_" + EEntityTransform.Sky; EntityTransform skyTransformClient = transformSkyGOClient.AddComponent <EntityTransform>(); skyTransformClient.EntityTransformType = EEntityTransform.Sky; transformRightHandGOClient.transform.SetParent(clientTemp.transform); transformRightHandGOClient.transform.localPosition = new Vector3(0, 0.5f, 0.25f); transformLeftHandGOClient.transform.SetParent(clientTemp.transform); transformLeftHandGOClient.transform.localPosition = new Vector3(0, 0.5f, 0.25f); transformCenterGOClient.transform.SetParent(clientTemp.transform); transformCenterGOClient.transform.localPosition = new Vector3(0, 0.5f, 0); transformCanvasGOClient.transform.SetParent(clientTemp.transform); transformCanvasGOClient.transform.localPosition = new Vector3(0, 1.3f, 0); transformFloorGOClient.transform.SetParent(clientTemp.transform); transformSkyGOClient.transform.SetParent(clientTemp.transform); transformSkyGOClient.transform.localPosition = new Vector3(0, 5f, 0); Debug.Log("Create Client prefab at " + folderPath + "/" + clientTemp.name + ".prefab"); UnityEngine.Object emptyPrefab = PrefabUtility.CreateEmptyPrefab(folderPath + "/" + clientTemp.name + ".prefab"); GameObject clientPrefab = PrefabUtility.ReplacePrefab(clientTemp, emptyPrefab, ReplacePrefabOptions.ConnectToPrefab); CreateCharacterData(clientTemp.GetComponent <Logic>()); GameObject.DestroyImmediate(GameObject.Find(clientTemp.name)); // SERVER PREFAB GameObject serverTemp = new GameObject(); GameObject modelServer = CharacterEditorWindow.Instantiate(m_characterModel); modelServer.name = m_characterName + " - Idle"; modelServer.transform.SetParent(serverTemp.transform); serverTemp.name = "Entity_" + m_characterName; serverTemp.layer = LayerMask.NameToLayer("Entity"); serverTemp.AddComponent <EntityCanvas>(); serverTemp.AddComponent <EntityBehaviour>(); NetworkIdentity networkIdentityServer = serverTemp.GetComponent <NetworkIdentity>(); networkIdentityServer.localPlayerAuthority = true; BoxCollider boxColliderServer = serverTemp.AddComponent <BoxCollider>(); boxColliderServer.center = new Vector3(0, 0.5f, 0); boxColliderServer.size = new Vector3(0.5f, 1, 0.5f); boxColliderServer.isTrigger = true; Logic serverLogic = serverTemp.AddComponent(logicType) as Logic; serverLogic.SetMobaEntity(serverTemp); networkIdentityServer.localPlayerAuthority = serverLogic.IsLocalPlayerAuthority(); EntityTransform modelServerTransform = modelServer.AddComponent <EntityTransform>(); modelServerTransform.EntityTransformType = EEntityTransform.Model; GameObject transformLeftHandGOServer = new GameObject(); transformLeftHandGOServer.name = "Transform_" + EEntityTransform.LeftHand; EntityTransform leftHandTransformServer = transformLeftHandGOServer.AddComponent <EntityTransform>(); leftHandTransformServer.EntityTransformType = EEntityTransform.LeftHand; GameObject transformRightHandGOServer = new GameObject(); transformRightHandGOServer.name = "Transform_" + EEntityTransform.RightHand; EntityTransform rightHandTransformServer = transformRightHandGOServer.AddComponent <EntityTransform>(); rightHandTransformServer.EntityTransformType = EEntityTransform.RightHand; GameObject transformCenterGOServer = new GameObject(); transformCenterGOServer.name = "Transform_" + EEntityTransform.Center; EntityTransform centerTransformServer = transformCenterGOServer.AddComponent <EntityTransform>(); centerTransformServer.EntityTransformType = EEntityTransform.Center; GameObject transformCanvasGOServer = new GameObject(); transformCanvasGOServer.name = "Transform_" + EEntityTransform.Head; EntityTransform canvasTransformServer = transformCanvasGOServer.AddComponent <EntityTransform>(); canvasTransformServer.EntityTransformType = EEntityTransform.Head; GameObject transformFloorGOServer = new GameObject(); transformFloorGOServer.name = "Transform_" + EEntityTransform.Floor; EntityTransform floorTransformServer = transformFloorGOServer.AddComponent <EntityTransform>(); floorTransformServer.EntityTransformType = EEntityTransform.Floor; GameObject transformSkyGOServer = new GameObject(); transformSkyGOServer.name = "Transform_" + EEntityTransform.Sky; EntityTransform skyTransformServer = transformSkyGOServer.AddComponent <EntityTransform>(); skyTransformServer.EntityTransformType = EEntityTransform.Sky; transformRightHandGOServer.transform.SetParent(serverTemp.transform); transformRightHandGOServer.transform.localPosition = new Vector3(0, 0.5f, 0.25f); transformLeftHandGOServer.transform.SetParent(serverTemp.transform); transformLeftHandGOServer.transform.localPosition = new Vector3(0, 0.5f, 0.25f); transformCenterGOServer.transform.SetParent(serverTemp.transform); transformCenterGOServer.transform.localPosition = new Vector3(0, 0.5f, 0); transformCanvasGOServer.transform.SetParent(serverTemp.transform); transformCanvasGOServer.transform.localPosition = new Vector3(0, 1.3f, 0); transformFloorGOServer.transform.SetParent(serverTemp.transform); transformSkyGOServer.transform.SetParent(serverTemp.transform); transformSkyGOServer.transform.localPosition = new Vector3(0, 5f, 0); UnityEngine.Object emptyPrefabServer = PrefabUtility.CreateEmptyPrefab(folderPath + "/" + serverTemp.name + ".prefab"); GameObject serverPrefab = PrefabUtility.ReplacePrefab(serverTemp, emptyPrefabServer, ReplacePrefabOptions.ConnectToPrefab); GameObject.DestroyImmediate(GameObject.Find(serverTemp.name)); PoolData clientCharacterPoolData = new PoolData(); clientCharacterPoolData.m_quantity = 0; clientCharacterPoolData.m_register = false; clientCharacterPoolData.m_obj = clientPrefab; PoolData serverCharacterPoolData = new PoolData(); serverCharacterPoolData.m_quantity = 0; serverCharacterPoolData.m_register = true; serverCharacterPoolData.m_obj = serverPrefab; holder.m_poolDataList.Add(clientCharacterPoolData); holder.m_poolDataList.Add(serverCharacterPoolData); PrefabUtility.ReplacePrefab(SpawnManager.instance.gameObject, PrefabUtility.GetPrefabParent(SpawnManager.instance), ReplacePrefabOptions.ConnectToPrefab); }
private void Awake() { instance = this; }
void Start() { dm = GameObject.FindGameObjectWithTag("DungeonMaster").GetComponent <PrefabHolder>(); DebugGen(); }
private void Awake() { Instance = this; LoadClones(); }
void Awake() { instance = this; }
/// <summary> /// updates references to objects, while also (de)activating things appropriately /// /// NOTE: does not include dependency injection's ResolveScene(), needs to be called manually if needed. See Global.LoadTravelSceneWithSiteCoroutine() /// </summary> /// <param name="scene_number"></param> public void switchSceneReupdateReferences(int scene_number) { if (p == null) { p = FindObjectOfType <Player>(); } if (p != null && player == null) { player = p.gameObject; } if (mainCanvas == null) { mainCanvas = GameObject.FindWithTag("Canvas"); } if (UICanvas == null) { UICanvas = GameObject.FindWithTag("UICanvas"); } if (mainCamera == null) { mainCamera = GameObject.FindWithTag("MainCamera").GetComponent <Camera>(); } if (uiCamera == null) { uiCamera = GameObject.Find("UICamera").GetComponent <Camera>(); } if (prefabHolder == null) { prefabHolder = FindObjectOfType <PrefabHolder>(); } if (vfxCanvas == null) { vfxCanvas = GameObject.FindWithTag("VfxCanvas"); } if (dialogue == null) { dialogue = GameObject.FindGameObjectWithTag("Dialogue").GetComponent <Dialogue>(); } switch (scene_number) { case Global.TITLE_SCENE_NUMBER: sceneType = GameMode.QUEST_SELECT; break; case Global.GAME_SCENE_NUMBER: sceneType = GameMode.GAME; if (Hs_Holder == null) { Hs_Holder = GameObject.Find("HeartsHolder"); //////////TODO } if (Ballz == null) { Ballz = mainCanvas.transform.Find("Ballz").gameObject; } HeartPopVFX = prefabHolder.heartPop; hearts = prefabHolder.hearts; aim = prefabHolder.aim; //gadgets are GOs like life container that are needed in game play but not in DLG mode if (gadgets != null) { foreach (GameObject g in gadgets) { g.SetActive(false); } } //setting mask to the right dimension GameObject BGMask = GameObject.FindWithTag("BGMask"); if (BGMask != null) { Vector3 sSize = BGMask.GetComponent <SpriteMask>().sprite.bounds.size; var ratioX = BGMask.GetComponent <RectTransform>().rect.width / sSize.x; var ratioY = BGMask.GetComponent <RectTransform>().rect.height / sSize.y; Vector3 scale = new Vector3(ratioX, ratioY - 0.04f, 1); BGMask.GetComponent <RectTransform>().localScale = scale; } p.navigationMode = Player.NavMode.ACCL; break; case Global.TRAVEL_SCENE_NUMBER: sceneType = GameMode.TRAVEL; camFollow.active = true; p.navigationMode = Player.NavMode.TOUCH; break; } }
void Awake() { Instance = this; }
public void StartCalledByWorldGenerator() { prefabHolder = GameObject.Find("PrefabHolder").GetComponent<PrefabHolder>(); }