private void Start() { countdown = initialTimeBeforeStart; spawnPointHolder = grid.GetComponent <SpawnPointHolder>(); spawnPoints = spawnPointHolder.spawnPoints; }
private void Awake() { if (instance != null) { Debug.LogError("More than one SpawnPointHolder in scene!"); return; } instance = this; }
public void StartGame() { cClothes = this.gameObject.GetComponent <ClothesHolder>(); if (cClothes == null) { Debug.Log("Game: Start: ClothesHolder is not attached! HELLO?"); } cClothes.Init(); cSuspicionController = this.gameObject.GetComponent <SuspicionController>(); if (cSuspicionController == null) { cSuspicionController = this.gameObject.AddComponent <SuspicionController>(); } cSuspicionController.Init(); cTargetManager = goTargetManager.GetComponent <TargetManager>(); if (cTargetManager == null) { Debug.Log("***WARNING*** cTargetManager NULL"); } cTargetManager.Init(); goSpawns = GameObject.Find("Spawn Point Container"); cSpawns = goSpawns.GetComponent <SpawnPointHolder>(); if (cSpawns == null) { Debug.Log("***WARNING*** CSpawns null"); } cSpawns.Reset(); //Characters GameObject player = Instantiate(playerPrefab); playerTransform = player.transform; PlayerController playerController = player.GetComponent <PlayerController>(); if (playerController != null) { playerController.SetClothes(cTargetManager.AgentData); } npcs.Add(Instantiate(NPCPrefab)); npcs[npcs.Count - 1].gameObject.transform.position = cSpawns.GetSpawnPoint().position; NPCController cNPCController = npcs[npcs.Count - 1].GetComponent <NPCController>(); if (cNPCController != null) { cNPCController.SetClothes(cTargetManager.TargetData); } CharacterCreationData npcData; for (int i = 0; i < MAX_NPC; ++i) { npcs.Add(Instantiate(NPCPrefab)); npcs[npcs.Count - 1].gameObject.transform.position = cSpawns.GetSpawnPoint().position; cNPCController = npcs[npcs.Count - 1].GetComponent <NPCController>(); if (cNPCController != null) { npcData = new CharacterCreationData(); npcData.lID[ClothesHolder.HATS_INDEX] = 0; npcData.lColor[ClothesHolder.HATS_INDEX] = cTargetManager.iHatID == i ? cTargetManager.TargetData.lColor[ClothesHolder.HATS_INDEX] : new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); npcData.lID[ClothesHolder.TOPS_INDEX] = 0; npcData.lColor[ClothesHolder.TOPS_INDEX] = cTargetManager.iTopID == i ? cTargetManager.TargetData.lColor[ClothesHolder.TOPS_INDEX] : new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); npcData.lID[ClothesHolder.BOTTOMS_INDEX] = 0; npcData.lColor[ClothesHolder.BOTTOMS_INDEX] = cTargetManager.iBottomID == i ? cTargetManager.TargetData.lColor[ClothesHolder.BOTTOMS_INDEX] : new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); cNPCController.SetClothes(npcData); } } GameObject.Find("FollowCamera").GetComponent <ShittyFollowCam>().StartCamera(); }
private void Awake() { towerManager = TowerManager.instance; spawnPointHolder = SpawnPointHolder.instance; }