public void Update(GV.CASETYPES cType, float height, bool isSpawnable = false, int team = -1) { this.cType = (int)cType; this.height = height; spawnable = isSpawnable; this.team = team; }
public CaseData(GV.BATTLEFIELDTYPE bType, GV.CASETYPES cType, Vector3 position, float height) { this.bType = (int)bType; this.cType = (int)cType; this.position = position; this.height = height; }
private string DefineSrtCaseType(GV.CASETYPES caseType) { string backer = ""; switch (caseType) { case GV.CASETYPES.Cactus: backer = "Sand"; break; case GV.CASETYPES.Oak: backer = "Grass"; break; case GV.CASETYPES.Fir: backer = "Snow"; break; default: backer = "Canyon"; break; } return(backer); }
public Case(GV.BATTLEFIELDTYPE bType, GV.CASETYPES cType, Vector3 position, float height, GameObject parent) { #region DummyManager if (cType == GV.CASETYPES.DUMMY) { Debug.Log("Auto generated case"); restart: switch (bType) { case GV.BATTLEFIELDTYPE.DUMMY: Debug.LogError("Shouldn't be dummy here"); bType = Utils.Instance.GetRandomEnum <GV.BATTLEFIELDTYPE>(1); goto restart; case GV.BATTLEFIELDTYPE.Desert: cType = GenerateDesertCase(); break; case GV.BATTLEFIELDTYPE.Temper: cType = GenerateMediumCase(); break; case GV.BATTLEFIELDTYPE.Ice: cType = GenerateIcedCase(); break; } } #endregion Height = height * GV._PerCaseHeight; CaseType = cType; GameObject = GameObject.Instantiate(Resources.Load <GameObject>(GV._PathToPrefabs + "BasicTile")); position.y = Height / 2; GameObject.transform.localPosition = position; GameObject.transform.localScale = new Vector3(1, Height, 1); if (cType == GV.CASETYPES.Cactus || cType == GV.CASETYPES.Fir || cType == GV.CASETYPES.Oak) { GenerateTree(cType.ToString()); GameObject.GetComponent <Renderer>().material = Resources.Load <Material>(GV._PathToMaterials + "Cases/" + DefineSrtCaseType(cType)); } else { GameObject.GetComponent <Renderer>().material = Resources.Load <Material>(GV._PathToMaterials + "Cases/" + cType.ToString()); } GameObject.transform.SetParent(parent.transform); GameObject.name = "tile_" + cType.ToString(); }
public void UpdateCase(Vector2Int pos, GV.CASETYPES cType, float height, bool spawnable, int team) { battleField[pos.x + (pos.y * size.x)].Update(cType, height, spawnable, team); }
void DoControls() { mapsNames = MapManager.Instance.GetAllMapsStr(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label("Select map", EditorStyles.boldLabel); mapIndex = GUILayout.SelectionGrid(mapIndex, mapsNames, 1, GUILayout.MaxWidth(150)); GUILayout.Label("Cases", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Heigth : "); newHeight = EditorGUILayout.IntSlider(newHeight, 1, 3); GUILayout.EndHorizontal(); string[] currentCasesTypes = new string[4]; currentCasesTypes[3] = GV.CASETYPES.Canyon.ToString(); switch (maps[mapIndex].type) { case GV.BATTLEFIELDTYPE.Desert: currentCasesTypes[0] = GV.CASETYPES.Sand.ToString(); currentCasesTypes[1] = GV.CASETYPES.Oasis.ToString(); currentCasesTypes[2] = GV.CASETYPES.Cactus.ToString(); break; case GV.BATTLEFIELDTYPE.Temper: currentCasesTypes[0] = GV.CASETYPES.Grass.ToString(); currentCasesTypes[1] = GV.CASETYPES.River.ToString(); currentCasesTypes[2] = GV.CASETYPES.Oak.ToString(); break; case GV.BATTLEFIELDTYPE.Ice: currentCasesTypes[0] = GV.CASETYPES.Snow.ToString(); currentCasesTypes[1] = GV.CASETYPES.Ice.ToString(); currentCasesTypes[2] = GV.CASETYPES.Fir.ToString(); break; } newCaseType = GUILayout.SelectionGrid(newCaseType, currentCasesTypes, 1, GUILayout.MaxWidth(150)); newCaseTypeEnum = Utils.Instance.StringToEnum <GV.CASETYPES>(currentCasesTypes[newCaseType]); spawnable = EditorGUILayout.Toggle("Is spawnable", spawnable); if (spawnable) { team = EditorGUILayout.IntSlider(team, 1, 3); } else { team = -1; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Save current map")) { MapManager.Instance.SaveMap(maps[mapIndex]); } if (GUILayout.Button("Save all maps")) { for (int i = 0; i < maps.Length; i++) { MapManager.Instance.SaveMap(maps[i]); } } GUILayout.EndVertical(); }