// Update is called once per frame void Update() { if (HomeSwitch.GetTouching()) { if (counter % 5 == 0) // amount of bullets fired in a second 27/5 per sec { //create a bullet object at the the center //GameObject newCube = (GameObject)Instantiate (bullets, new Vector3 (camera[0], camera[1], camera[2]), transform.rotation); GameObject newCube = (GameObject)Instantiate(bullets, new Vector3(100f, 100f, 100f), transform.rotation); //This puts the cube under the camra newCube.transform.parent = gameObject.transform; //Move newCube in to center of the camra newCube.transform.position = new Vector3(camera[0], camera[1], camera[2]); newCube.transform.Rotate((float)HomeSwitch.getXY(1), (float)HomeSwitch.getXY(0), 0); //force newCube.constantForce.relativeForce = new Vector3(0, 0, 1000); //rotate the object //newCube.transform.Rotate(10,0,0); } } //This will throdle the rate at which we do thing in update by being % counter++; }
/// <summary> /// Changes the settings. /// </summary>/ void changeSettings() { //changing the color of the tiles with settings from unity if (HomeSwitch.getColorChange()) { R2 = HomeSwitch.getColor(0); G2 = HomeSwitch.getColor(1); B2 = HomeSwitch.getColor(2); R1 = HomeSwitch.getColor(3); G1 = HomeSwitch.getColor(4); B1 = HomeSwitch.getColor(5); HomeSwitch.setColorChange(false); } //this if statement checks to see if the colorChance has changed in the settings // if it has then we change it if (HomeSwitch.getColorChance() != colorChance) { colorChance = HomeSwitch.getColorChance(); if (testing) { colorChance = 100; } } }
// Update is called once per frame void Update() { if (HomeSwitch.GetTouching()) { //get the name of the brick boxName = VectorsScr.getBoxName(); // get the name from VectorsScr string[] digit = boxName.Split(','); // split the name of the box by the , int boxIndex; Int32.TryParse(digit[1], out boxIndex); // change the sting to an int //move that brick up to 1.5 if (boxIndex >= 0 && boxIndex <= grid.myField.fieldSize) { touchBrick(boxIndex); } //then move the rest of the bricks around it up to 1 // then move the bricks around the rest of the brick up to .5 } //once were no longer touching the screen cubeMan will take over again with normal movments }
void selectBrickMove() { int ranMove; // ranMove is randomly genorated from 0 to 100 if (HomeSwitch.GetTouching() == false) { ranMove = Random.Range(0, 100); } else { ranMove = Random.Range(0, 20); } // ranBrick is a random number to select one of the bricks int ranBrick = Random.Range(0, grid.myField.fieldSize); if (ranMove >= 0 && ranMove <= 33) { while (grid.myField.fieldArray[ranBrick].move == true) { ranBrick = Random.Range(0, grid.myField.fieldSize); } if (grid.myField.fieldArray[ranBrick].move != true) { grid.myField.fieldArray[ranBrick].move = true; grid.myField.fieldArray[ranBrick].pos = 0; } } //pos1 if (ranMove >= 34 && ranMove <= 66) { while (grid.myField.fieldArray[ranBrick].move == true) { ranBrick = Random.Range(0, grid.myField.fieldSize); } if (grid.myField.fieldArray[ranBrick].move != true) { //Debug.Log("pos2 with :" + ranBrick); grid.myField.fieldArray[ranBrick].move = true; grid.myField.fieldArray[ranBrick].pos = 1; } } //pos2 if (ranMove >= 67 && ranMove <= 99) { while (grid.myField.fieldArray[ranBrick].move == true) { ranBrick = Random.Range(0, grid.myField.fieldSize); } if (grid.myField.fieldArray[ranBrick].move != true) { //Debug.Log("pos3 with :" + ranBrick); grid.myField.fieldArray[ranBrick].move = true; grid.myField.fieldArray[ranBrick].pos = 2; } } }
void ReleaseDesignerOutlets() { if (AreaSwitch != null) { AreaSwitch.Dispose(); AreaSwitch = null; } if (BuilderSwitch != null) { BuilderSwitch.Dispose(); BuilderSwitch = null; } if (CategoryErrorLabel != null) { CategoryErrorLabel.Dispose(); CategoryErrorLabel = null; } if (CircumstantialSwitch != null) { CircumstantialSwitch.Dispose(); CircumstantialSwitch = null; } if (CommunitySwitch != null) { CommunitySwitch.Dispose(); CommunitySwitch = null; } if (EconomicClimateSwitch != null) { EconomicClimateSwitch.Dispose(); EconomicClimateSwitch = null; } if (FinalDecisionSwitch != null) { FinalDecisionSwitch.Dispose(); FinalDecisionSwitch = null; } if (FinancingSwitch != null) { FinancingSwitch.Dispose(); FinancingSwitch = null; } if (HomeSiteSwitch != null) { HomeSiteSwitch.Dispose(); HomeSiteSwitch = null; } if (HomeSwitch != null) { HomeSwitch.Dispose(); HomeSwitch = null; } if (MarketSwitch != null) { MarketSwitch.Dispose(); MarketSwitch = null; } if (RankingTextField != null) { RankingTextField.Dispose(); RankingTextField = null; } if (DeactiveReasonTextField != null) { DeactiveReasonTextField.Dispose(); DeactiveReasonTextField = null; } if (SecondFinalDecisionSwitch != null) { SecondFinalDecisionSwitch.Dispose(); SecondFinalDecisionSwitch = null; } if (SystemRankingLabel != null) { SystemRankingLabel.Dispose(); SystemRankingLabel = null; } if (UnstatisifedSwitch != null) { UnstatisifedSwitch.Dispose(); UnstatisifedSwitch = null; } if (XFactorSwitch != null) { XFactorSwitch.Dispose(); XFactorSwitch = null; } }