// Use this for initialization void Start() { speed = initSpeed; rigid = this.gameObject.GetComponent <Rigidbody>(); generator = GameObject.Find("Generator").GetComponent <Map_Generator>(); anim = this.GetComponent <Animator>(); }
void Awake() { if (!map_generator) { map_generator = GameObject.FindGameObjectWithTag ("Map").GetComponent<Map_Generator> (); map_width = map_generator.width; map_height = map_generator.height; minSpawnX = map_width / 10; minSpawnY = map_height / 10; } else { map_width = map_generator.width; map_height = map_generator.height; minSpawnX = map_width / 10; minSpawnY = map_height / 10; } InitializeAllSpawnPositions (); if (resourceGrid == null) resourceGrid = GameObject.FindGameObjectWithTag ("Map").GetComponent<ResourceGrid> (); // Store the paths (List<Node>) in a queue // // foreach (List<Node> path in paths) { // pathQueue.Enqueue(path); // } // // // foreach (List<Node> path in paths) { // kamikazePathQueue.Enqueue(path); // } // Create some random Kamikaze positions GetRandomKamikazeDestinations (); }
private void Awake() { if (GameObject.FindGameObjectWithTag("Map").GetComponent <Map_Generator>() != null) { MapLocal = GameObject.FindGameObjectWithTag("Map").GetComponent <Map_Generator>(); } else { Debug.Log("Map_Generator could not be found"); } //Gotta call the UI when it is moving if (GameObject.FindGameObjectWithTag("MainCamera").GetComponent <UI_Manager>() != null) { UI_MLocal = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <UI_Manager>(); } else { Debug.Log("UI_Manager could not be found"); } if (this.gameObject.tag == "Main_Pl") { IsThisMainP = true; } else { IsThisMainP = false; } }
// Start is called before the first frame update void Start() { foreach (Unit U in EnemyHolder.transform.GetComponentsInChildren <Unit>()) //create a way to detect when a new enemy is detected and add to it { AllEnemies.Add(U); } LocalMap = this.GetComponent <Map_Generator>(); StartCoroutine(Refresh()); }
private void Start() { grid = GameObject.FindGameObjectWithTag("Map").GetComponent <GridLayout>(); MapGRef = grid.gameObject.GetComponent <Map_Generator>(); UIM = this.GetComponent <UI_Manager>(); Scroll = LastScroll; MapEdgeDebug = ((StaticMapConf.Size) / 2); }
void Awake() { if (!mapGenScript) { mapGenScript = GameObject.FindGameObjectWithTag("Map").GetComponent<Map_Generator>(); }else{ levelWidth = mapGenScript.width; levelHeight = mapGenScript.height; // Now that Height and Width are set, build texture mesh_renderer = GetComponent<MeshRenderer> (); BuildTexture (); } }
void Start() { LocalMap = this.GetComponent <Map_Generator>(); // HideAllTiles(); StartCoroutine(UpdateAllTiles()); StartCoroutine(GivePlayerVision()); // GivePlayerVision(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Map_Generator generator = (Map_Generator)target; if (GUILayout.Button("Generate Tilemap")) { generator.Generate_Tilemap(); } if (GUILayout.Button("Clear All Tilemap")) { generator.ClearAllTiles(); } }
public override void OnInspectorGUI() { Map_Generator mapGen = (Map_Generator)target; if (DrawDefaultInspector()) { if (mapGen.autoUpdate) { mapGen.GenerateMap(); } } if (GUILayout.Button("Generator")) { mapGen.GenerateMap(); } }
private void Start() { //Add the keys (I will have to automate this so it is easier to add stuff) TileTypeDic.Add(TileType.Ground, TileIcon[0]); TileTypeDic.Add(TileType.Water, TileIcon[1]); MaterialDic.Add(MaterialTile.None, MaterialIcon[0]); MaterialDic.Add(MaterialTile.Tree, MaterialIcon[1]); MaterialDic.Add(MaterialTile.Wall, MaterialIcon[2]); MapLocal = GameObject.FindGameObjectWithTag("Map").GetComponent <Map_Generator>(); InputM = this.GetComponent <InputManager>(); if (MapLocal == null) { Debug.Log("Map reference could not be found"); } if (StartSelectingUnit != null) { StartCoroutine(SelectWithDelay()); } ChangeOfSelection(); }
// Use this for initialization void Start() { generator = GameObject.Find("Generator").GetComponent <Map_Generator>(); }
void move() { if (index > length) { GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube); if (index > 4 && index < 10) { obj.transform.tag = cube_tag; obj.GetComponent <MeshRenderer>().material = mat_des; obj.AddComponent <wallscript>(); GG.Destructible.Add(obj); } else { obj.transform.tag = "cube"; obj.GetComponent <MeshRenderer>().material = mat; } Destroy(obj.GetComponent <BoxCollider>()); obj.transform.localScale = ObjScale; obj.AddComponent <Box_collision>(); obj.transform.position = new Vector3(turtle.transform.position.x, 0.5f, turtle.transform.position.z); obj.transform.Rotate(turtle.transform.eulerAngles.x, turtle.transform.eulerAngles.y, turtle.transform.eulerAngles.z); obj.AddComponent <NavMeshObstacle>(); prev.transform.localScale = rescale; prev = obj; GameObject obj2 = GameObject.CreatePrimitive(PrimitiveType.Cube); if (index > 4 && index < 10) { obj2.transform.tag = cube_tag; obj2.GetComponent <MeshRenderer>().material = mat_des; obj2.AddComponent <wallscript>(); GG.Destructible.Add(obj2); } else { obj2.transform.tag = "cube"; obj2.GetComponent <MeshRenderer>().material = mat; } Destroy(obj2.GetComponent <BoxCollider>()); obj2.transform.localScale = ObjScale; obj2.AddComponent <Box_collision>(); obj2.transform.position = new Vector3(-turtle.transform.position.x, 0.5f, -turtle.transform.position.z); Vector3 rot = new Vector3(0f, (float)rotation, 0f); obj2.transform.Rotate(rot, Space.Self); NavMeshObstacle NMO = obj2.AddComponent <NavMeshObstacle>(); NMO.carving = true; prevInvert.transform.localScale = rescale; prevInvert = obj2; int lengthNew = (int)Random.Range(15f, 20f); int rotationNew = (int)Random.Range(20f, 50f); GameObject branch1 = new GameObject(); branch1.transform.Translate(turtle.transform.position.x, turtle.transform.position.y, turtle.transform.position.z); GameObject branch2 = new GameObject(); branch2.transform.Translate(turtle.transform.position.x, turtle.transform.position.y + rotationNew, turtle.transform.position.z); Map_Generator b1 = branch1.AddComponent <Map_Generator>(); Map_Generator b2 = branch2.AddComponent <Map_Generator>(); b1.length = lengthNew; b2.length = lengthNew; b1.rotation = rotation + rotationNew; b2.rotation = rotation - rotationNew; b1.mat = mat; b2.mat = mat; b1.mat_des = mat_des; b2.mat_des = mat_des; b1.prev = obj; b1.prevInvert = obj2; b2.prev = obj; b2.prevInvert = obj2; b1.rescale = rescale; b2.rescale = rescale; Destroy(this.gameObject); } else { float step = 1; GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube); if (index > 4 && index < 10) { obj.transform.tag = cube_tag; obj.GetComponent <MeshRenderer>().material = mat_des; obj.AddComponent <wallscript>(); GG.Destructible.Add(obj); } else { obj.transform.tag = "cube"; obj.GetComponent <MeshRenderer>().material = mat; } Destroy(obj.GetComponent <BoxCollider>()); obj.transform.localScale = ObjScale; obj.AddComponent <Box_collision>(); NavMeshObstacle NMO = obj.AddComponent <NavMeshObstacle>(); NMO.carving = true; obj.transform.position = new Vector3(turtle.transform.position.x, 0.5f, turtle.transform.position.z); obj.transform.Rotate(turtle.transform.eulerAngles.x, turtle.transform.eulerAngles.y, turtle.transform.eulerAngles.z); prev.transform.localScale = rescale; prev = obj; GameObject obj2 = GameObject.CreatePrimitive(PrimitiveType.Cube); if (index > 4 && index < 10) { obj2.transform.tag = cube_tag; obj2.GetComponent <MeshRenderer>().material = mat_des; obj2.AddComponent <wallscript>(); GG.Destructible.Add(obj2); } else { obj2.transform.tag = "cube"; obj2.GetComponent <MeshRenderer>().material = mat; } Destroy(obj2.GetComponent <BoxCollider>()); obj2.transform.localScale = ObjScale; obj2.AddComponent <Box_collision>(); NavMeshObstacle NMO2 = obj2.AddComponent <NavMeshObstacle>(); NMO2.carving = true; obj2.transform.position = new Vector3(-turtle.transform.position.x, 0.5f, -turtle.transform.position.z); Vector3 rot = new Vector3(0f, (float)rotation, 0f); obj2.transform.Rotate(rot, Space.Self); prevInvert.transform.localScale = rescale; prevInvert = obj2; turtle.transform.Translate(step + 0.05f, 0, 0); turtle.transform.position = new Vector3(turtle.transform.position.x, 0.6f, turtle.transform.position.z); prev.AddComponent <BoxCollider>(); prevInvert.AddComponent <BoxCollider>(); index++; } }