public void changeModel() //changes models position or deactivates it { //_rocketModels[_selectedModel].transform.position = offScreenPosition; //_rocketModels[_selectedModel].eulersAngles = new Vector3(0, 0, 0); //reset orientation of model _selectedModelIndex = IntBounds.SetInt(_selectedModelIndex, horizontal, 0, 1); //_rocketModels[_selectedModel].transform.position = new Vector3(_rocketModels[_selectedModel.p }
public IntBounds Union(IntBounds other) { return(new IntBounds { XMin = Mathf.Min(XMin, other.XMin), XMax = Mathf.Max(XMax, other.XMax), YMin = Mathf.Min(YMin, other.YMin), YMax = Mathf.Max(YMax, other.YMax) }); }
private void UpdateCells() { var r = _liveArea; r.position -= (_liveArea.position + _liveArea.size / 2) * ParallaxMultiplier; var newBounds = IntBounds.FromRect(r, CellSize); if (_cellBounds == newBounds) { return; // Same cell bounds, do nothing } var union = _cellBounds.Union(newBounds); for (var y = union.YMin; y <= union.YMax; y++) { for (var x = union.XMin; x <= union.XMax; x++) { if (_cellBounds.Contains(x, y) && newBounds.Contains(x, y)) { continue; // Cell is in both rectangles, no need to update } if (newBounds.Contains(x, y)) { CreateCell(x, y); } } } // Cleanup old cells, can be optimized (see above) var destroy = new List <int>(); foreach (var cell in _cells.Values) { if (!newBounds.Contains(cell.X, cell.Y)) { destroy.Add(cell.Hash); } } foreach (var h in destroy) { DestroyCell(h); } _cellBounds = newBounds; }
void Update() { getInput(); foreach (Transform child in transform) { child.renderer.enabled = true; } _camera.transform.position = Vector3.Lerp(_camera.transform.position, _destination.position, Time.deltaTime * 3f); _camera.transform.rotation = Quaternion.Lerp(_camera.transform.rotation, Quaternion.Euler(new Vector3(0, 0, 0)), Time.deltaTime * 3f); float x; float y; float z; if (vertical != 0) { _source.PlayOneShot(_cursor); MenuItems[_selected].renderer.material.color = Color.white; x = MenuItems[_selected].transform.localScale.x / 1.1f; y = MenuItems[_selected].transform.localScale.y / 1.1f; z = MenuItems[_selected].transform.localScale.z; MenuItems[_selected].transform.localScale = new Vector3(x, y, z); _selected = IntBounds.SetInt(_selected, -vertical, 0, 3); MenuItems[_selected].renderer.material.color = Color.yellow; x = MenuItems[_selected].transform.localScale.x * 1.1f; y = MenuItems[_selected].transform.localScale.y * 1.1f; z = MenuItems[_selected].transform.localScale.z; MenuItems[_selected].transform.localScale = new Vector3(x, y, z); } if (a == true) { foreach (Transform child in transform) { child.renderer.enabled = false; } switch (_selected) { case 0: _source.PlayOneShot(_confirm, 1f); _playMenu.enabled = true; this.enabled = false; break; case 1: _source.PlayOneShot(_confirm, 1f); _settingsMenu.enabled = true; this.enabled = false; break; case 2: _extrasMenu.enabled = true; _source.PlayOneShot(_confirm); this.enabled = false; break; case 3: PlayerPrefs.Save(); //Unnecessary Application.Quit(); break; } } }
void Update() { getInput(); _camera.transform.position = Vector3.Lerp(_camera.transform.position, _destination.position, Time.deltaTime * 3f); _camera.transform.rotation = Quaternion.Lerp(_camera.transform.rotation, Quaternion.Euler(new Vector3(0, -90f, 0)), Time.deltaTime * 3f); if (vertical != 0) { MenuItems[_selected].renderer.material.color = Color.white; _selected = IntBounds.SetInt(_selected, -Input.GetAxis("Vertical 1"), 0, 5); MenuItems[_selected].renderer.material.color = Color.yellow; _source.PlayOneShot(_cursor); } switch (_selected) { case 0: if (horizontal != 0) { //_resNumber += (int)Input.GetAxisRaw("Horizontal 1"); //MenuItems[0].GetComponent<TextMesh>().text = "Resolution: " + resolutions[_resNumber].width + "x" + resolutions[_resNumber].height; } break; case 1: break; case 2: break; case 3: break; case 4: //Apply button if (a == true) { // = resolutions[_resNumber].width; //yRes = resolutions[_resNumber].height; //Screen.SetResolution(resolutions[_resNumber].width, resolutions[_resNumber].height, _isFullScreen, 0); PlayerPrefs.SetInt("Resolution Number", _resNumber); PlayerPrefs.SetInt("xResolution", xRes); PlayerPrefs.SetInt("yResolution", yRes); PlayerPrefs.Save(); foreach (Transform child in transform) { child.renderer.enabled = false; } _mainMenu.enabled = true; this.enabled = false; } break; case 5: //Cancel button if (a == true) { _mainMenu.enabled = true; foreach (Transform child in transform) { child.renderer.enabled = false; } this.enabled = false; } break; case 6: break; } if (b == true) { foreach (Transform child in transform) { child.renderer.enabled = false; } _mainMenu.enabled = true; _mainMenu._moveActionUsed = true; _source.PlayOneShot(_back); this.enabled = false; } }
public static void Copy(NativeArray <T> input, NativeArray <T> output, int3 inputSize, int3 outputSize, IntBounds inputBounds, IntBounds outputBounds) { Assert(input.Length == inputSize.x * inputSize.y * inputSize.z); Assert(output.Length == outputSize.x * outputSize.y * outputSize.z); Assert(math.all(inputBounds.min >= 0 & inputBounds.max <= inputSize)); Assert(math.all(outputBounds.min >= 0 & outputBounds.max <= outputSize)); Assert(math.all(inputBounds.size == outputBounds.size)); if (math.all(inputSize == outputSize & inputBounds.size == inputSize)) { // One contiguous chunk input.CopyTo(output); } else { // Copy row-by-row var inputStrides = new int3(1, inputSize.x * inputSize.z, inputSize.x); var outputStrides = new int3(1, outputSize.x * outputSize.z, outputSize.x); for (int y = 0; y < outputBounds.size.y; y++) { for (int z = 0; z < outputBounds.size.z; z++) { var rowOffsetInput = math.csum((new int3(0, y, z) + inputBounds.min) * inputStrides); var rowOffsetOutput = math.csum((new int3(0, y, z) + outputBounds.min) * outputStrides); // Using a raw MemCpy call is a bit faster, but that requires unsafe code // Using a for loop is *a lot* slower (except for very small arrays, in which case it is about the same or very slightly faster). NativeArray <T> .Copy(input, rowOffsetInput, output, rowOffsetOutput, outputBounds.size.x); } } } }
void Update() { getInput(); foreach (Transform child in transform) { child.renderer.enabled = true; } _camera.transform.position = Vector3.Lerp(_camera.transform.position, _destination.position, Time.deltaTime * 3f); _camera.transform.rotation = Quaternion.Lerp(_camera.transform.rotation, Quaternion.Euler(new Vector3(0, 90f, 0)), Time.deltaTime * 3f); float x; float y; float z; if (vertical != 0) { _source.PlayOneShot(_cursor); _MenuItems[_selected].renderer.material.color = Color.white; x = _MenuItems[_selected].transform.localScale.x / 1.1f; y = _MenuItems[_selected].transform.localScale.y / 1.1f; z = _MenuItems[_selected].transform.localScale.z; _MenuItems[_selected].transform.localScale = new Vector3(x, y, z); _selected = IntBounds.SetInt(_selected, -vertical, 0, 2); _MenuItems[_selected].renderer.material.color = Color.yellow; x = _MenuItems[_selected].transform.localScale.x * 1.1f; y = _MenuItems[_selected].transform.localScale.y * 1.1f; z = _MenuItems[_selected].transform.localScale.z; _MenuItems[_selected].transform.localScale = new Vector3(x, y, z); } if (b == true) { foreach (Transform child in transform) { child.renderer.enabled = false; } _mainMenu.enabled = true; _source.PlayOneShot(_back); this.enabled = false; } switch (_selected) { case 0: if (horizontal != 0) { PlayMenu._numberOfPlayers = IntBounds.SetInt(PlayMenu._numberOfPlayers, Input.GetAxis("Horizontal 1"), 1, 4); _MenuItems[0].GetComponent <TextMesh>().text = "Number of players: " + PlayMenu._numberOfPlayers; _source.PlayOneShot(_cursor); } break; case 1: if (a == true) { _gameSettingsMenu.enabled = true; } /*if (horizontal != 0) * { * _gameMode = IntBounds.SetInt(_gameMode, Input.GetAxis("Horizontal 1"), 0, 0); * _MenuItems[1].GetComponent<TextMesh>().text = "Game Mode: " + _gameMode; * _source.PlayOneShot(_cursor); * }*/ break; case 2: if (a) { switch (_gameMode) { case 0: _source.PlayOneShot(_confirm, 1f); BoardGameHandler.ResetGame(); Application.LoadLevel(1); //need to scene fade break; } } break; } }
void Update() { foreach (Transform child in transform) { child.renderer.enabled = true; } float x; float y; float z; if (Input.GetAxis("Vertical 1") != 0 && _action == false) { _source.PlayOneShot(_cursor); MenuItems[_selected].renderer.material.color = Color.white; x = MenuItems[_selected].transform.localScale.x / 1.1f; y = MenuItems[_selected].transform.localScale.y / 1.1f; z = MenuItems[_selected].transform.localScale.z; MenuItems[_selected].transform.localScale = new Vector3(x, y, z); _selected = IntBounds.SetInt(_selected, -Input.GetAxisRaw("Vertical 1"), 0, 1); MenuItems[_selected].renderer.material.color = Color.yellow; x = MenuItems[_selected].transform.localScale.x * 1.1f; y = MenuItems[_selected].transform.localScale.y * 1.1f; z = MenuItems[_selected].transform.localScale.z; MenuItems[_selected].transform.localScale = new Vector3(x, y, z); _action = true; } if (Input.GetAxis("Vertical 1") == 0) { _action = false; } if (Input.GetAxis("B1") == 1) { _source.PlayOneShot(_back); _mainMenu.enabled = true; foreach (Transform child in transform) { child.renderer.enabled = false; } this.enabled = false; } if (Input.GetAxis("A1") == 1) { switch (_selected) { case 0: break; case 1: break; case 2: break; case 3: break; } } }
public static Vector3 NodePosition(Matrix4x4 graphToWorld, IntBounds bounds, int x, int z) { return(graphToWorld.MultiplyPoint3x4(new Vector3((bounds.min.x + x) + 0.5f, 0, (bounds.min.z + z) + 0.5f))); }
public int LayerCount(IntBounds bounds) => bounds.size.y;
public int LayerCount(IntBounds bounds) { UnityEngine.Assertions.Assert.IsTrue(bounds.size.y == 1); return(1); }
public void changeMaterial() { _selectedMaterialIndex = IntBounds.SetInt(_selectedMaterialIndex, vertical, 0, 4); _rocketModels[_selectedModelIndex].renderer.material = _materials[_selectedModelIndex][_selectedMaterialIndex]; //left joystick vertical input changes the index of the material and then sets it }