public void SetCellEnviornment(Enviroments enviroments) { isCellActive = 1; cellEnviornment = enviroments; // ChooseEnviornemnt(); ChooseCellColorEnviornemnt(); SetActiveCell(); }
public void SpawnCell(Enviroments cellColorEnviroments, Enviroments cellBackgroundColorEnviornment, int alive) { cellEnviornment = cellColorEnviroments; backgroundEnvionment = cellBackgroundColorEnviornment; isCellActive = alive; ChooseCellColorEnviornemnt(); ChooseBackgroundColorEnviornemnt(); }
public bool IsValidEnviroment(params string[] enviroments) { Check.NotNull(enviroments, nameof(enviroments)); return(ExecutionType == ExecuteOn.Any && Enviroments.Any(row => Enviroments.Contains(row)) || ExecutionType == ExecuteOn.All && ContainsAll(enviroments, Enviroments)); bool ContainsAll <T>(IEnumerable <T> source, IEnumerable <T> values) { return(values.All(source.Contains)); } }
private void SetInitalArray() { int enviornment = 0; int count = 0; int currentLimit = (gridHeight * _gridWidth) / 4; Debug.Log(currentLimit); _gridWidth = Mathf.RoundToInt(gridHeight * Camera.main.aspect); _cellsArray = new GameObject[gridHeight, _gridWidth]; _gridCellsArray = new GridCell[gridHeight, _gridWidth]; CellSize = (Camera.main.orthographicSize * 2) / gridHeight;//size of a cell print("DIMINESIONS: " + _gridWidth + "X" + gridHeight); print("CELL SIZE: " + CellSize); Enviroments randomEnviornment = (Enviroments)Random.Range(0, 4); for (int i = 0; i < gridHeight; i++) { int timesOfSameRandom = Random.Range(20, 80); for (int j = 0; j < _gridWidth; j++) { if (timesOfSameRandom <= 0) { randomEnviornment = (Enviroments)Random.Range(0, 4); timesOfSameRandom = Random.Range(20, 80); } timesOfSameRandom--; _cellsArray[i, j] = Instantiate(gridCellTemplate); _gridCellsArray[i, j] = _cellsArray[i, j].GetComponent <GridCell>(); count++; if (count == currentLimit) { enviornment++; count = 0; } _gridCellsArray[i, j].SetBackgroundEnviornment(randomEnviornment); } } for (int i = 0; i < countDeadZone; i++) { _gridCellsArray[Random.Range(0, gridHeight), Random.Range(0, _gridWidth)]. SetBackgroundEnviornment(Enviroments.DeadZone); } }
public void PlayerInEnviroment(Enviroments enviroment) { enviromentPlayerIn = enviroment; }
public List <BaitTypes> GetBaitsForTrap(TrapType trapType, Enviroments enviroment) { return(BaitForEachTrap[new KeyValuePair <TrapType, Enviroments>(trapType, enviroment)]); }
public void SetBackgroundEnviornment(Enviroments enviroments) { backgroundEnvionment = enviroments; ChooseBackgroundColorEnviornemnt(); }
private void ApplyRules() { int[,] NextGenGrid = new int[gridHeight, _gridWidth]; Enviroments[,] nextCellColor = new Enviroments[gridHeight, _gridWidth]; Enviroments[,] nextEnviornmentColor = new Enviroments[gridHeight, _gridWidth]; for (int i = 0; i < gridHeight; i++) { for (int j = 0; j < _gridWidth; j++) { int livingNeighbours = 0; GridCell currentCell = _gridCellsArray[i, j]; Enviroments auxCellEnviornment = currentCell.cellEnviornment; List <GridCell> cells = new List <GridCell>(); if (currentCell.backgroundEnvionment == Enviroments.DeadZone) { continue; } if (currentCell.isCellDevelopingSlowly) { currentCell.SetIfCellDevelopingSlowly(true); continue; } cells = CountLivingNeighbours(i, j); int livingNeighboursRed = 0; int livingNeighboursGrey = 0; int livingNeighboursYellow = 0; int livingNeighboursBlue = 0; foreach (GridCell cell in cells) { if (cell.isCellActive == 1) { switch (cell.cellEnviornment) { case Enviroments.TargarienRed: livingNeighboursRed++; break; case Enviroments.StarkGrey: livingNeighboursGrey++; break; case Enviroments.LannisterYellow: livingNeighboursYellow++; break; case Enviroments.FreePeopleBlue: livingNeighboursBlue++; break; case Enviroments.None: break; } } } if (livingNeighboursRed > livingNeighboursGrey && livingNeighboursRed > livingNeighboursYellow && livingNeighboursRed > livingNeighboursBlue) { livingNeighbours = livingNeighboursRed; auxCellEnviornment = Enviroments.TargarienRed; } else if (livingNeighboursGrey > livingNeighboursRed && livingNeighboursGrey > livingNeighboursYellow && livingNeighboursGrey > livingNeighboursBlue) { livingNeighbours = livingNeighboursGrey; auxCellEnviornment = Enviroments.StarkGrey; } else if (livingNeighboursYellow > livingNeighboursRed && livingNeighboursYellow > livingNeighboursGrey && livingNeighboursYellow > livingNeighboursBlue) { livingNeighbours = livingNeighboursYellow; auxCellEnviornment = Enviroments.LannisterYellow; } else if (livingNeighboursBlue > livingNeighboursRed && livingNeighboursBlue > livingNeighboursGrey && livingNeighboursBlue > livingNeighboursYellow) { livingNeighbours = livingNeighboursBlue; auxCellEnviornment = Enviroments.FreePeopleBlue; } if (livingNeighbours == 4) { nextEnviornmentColor[i, j] = auxCellEnviornment; } else { nextEnviornmentColor[i, j] = currentCell.backgroundEnvionment; } if (livingNeighbours == 3) { NextGenGrid[i, j] = 1; nextCellColor[i, j] = auxCellEnviornment; } else if (livingNeighbours == 2) { NextGenGrid[i, j] = 1; nextCellColor[i, j] = Enviroments.None; } else if (livingNeighbours == 1) { NextGenGrid[i, j] = 0; nextCellColor[i, j] = Enviroments.None; } else { nextCellColor[i, j] = currentCell.cellEnviornment; } } } for (int i = 0; i < gridHeight; i++) { for (int j = 0; j < _gridWidth; j++) { GridCell cell = _gridCellsArray[i, j]; if (cell.backgroundEnvionment == Enviroments.DeadZone) { continue; } if (cell.GetIfCellEnviornmentEqualsWithBack()) { cell.SetIfCellDevelopingSlowly(false); continue; } cell.SpawnCell(nextCellColor[i, j], nextEnviornmentColor[i, j], NextGenGrid[i, j]); } } }
public void SetUserEnviornment(int numberOfEnviornment) { _sizeOfStep = Instatiator.CellSize / 2; Debug.Log(_sizeOfStep); userEnviornment = (Enviroments)numberOfEnviornment; }
/// <summary> /// This will update the build quality for the build /// </summary> /// <param name="env">The environment you want the build to be in, /// ex/ Assembly will change build quality "In-Assembly" /// </param> /// <returns></returns> public bool ChangeBuildQuality(Enviroments env) { return (ChangeBuildQuality("In-" + env.ToString())); }
/// <summary> /// This will deploy the build package to the given test environment /// </summary> /// <param name="env"></param> /// <returns></returns> public bool DeployBuildTo(Enviroments env) { bool _wasSuccessfullyDeployed = true; //reason for this duoble change of buildQuality //The Deployer has a set path of how builds can be deploy to and from //there4 you cannot deploy from some env to others, but you can redeploy //to any env. This way we can ensure that we get a deployer triggered //running a redeploy, //which is change the BQ to In-env then change it again to Deploy2-env //ex/ if deploying to IRB you would first change the BQ to "In-IRB" then //change it to "Deploy2-IRB" foreach (string _app in _bqAppend) { string _bq = _app + env.ToString(); if (_bq.Equals("In-IRB")) { _bq = "In-PrePrd"; // IRB is only env that does not have redeploys set up } _wasSuccessfullyDeployed = ChangeBuildQuality(_bq); } return (_wasSuccessfullyDeployed); }