private void ManageYOverflow(Vector3 mouseWorldCoord, string orientation, float yBound) { if (_verticalOrientation != orientation) { DeletePlacers(); _verticalOrientation = orientation; } int xMultiplier = _horizontalOrientation == Orientation.EAST ? 1 : -1; int yMultiplier = _verticalOrientation == Orientation.NORTH ? 1 : -1; PlacementData placementData = _subPlacerPrefab.toPlace; int placersToAdd = (int)(Mathf.Abs(mouseWorldCoord.y - yBound) / placementData.unitsHeight); /* * La condition de cette boucle vérifie qu'il faut encore ajouter une ligne * de placeurs et qu'on ne viole pas la limite de placeurs en l'ajoutant. */ for (int i = 1; i <= placersToAdd && _placersNber + _allPlacers.First.Value.Count < maxPlacersNber; i++) { LinkedList <BuildingPlacer> newLine = new LinkedList <BuildingPlacer>(); _allPlacers.AddLast(newLine); for (int x = 0; x <= _allPlacers.First.Value.Count; x++)//<= et pas <, car le placeur de départ occupe une case mais n'est pas compris dans les collections (pou éviter de le supprimer), il faut donc compenser ça ! { Vector3 newPosition = new Vector3(_initialPlacementCoord.x + x * xMultiplier * placementData.unitsWidth, yBound + i * yMultiplier * placementData.unitsHeight, _subPlacerPrefab.transform.position.z); BuildingPlacer newPlacer = CreateNewPlacer(newPosition); newLine.AddLast(newPlacer); TakePlacerIntoAccount(newPlacer); } } }
// Start is called before the first frame update void Start() { championPrepController = GameManager.instance.GetChampionPrepController(); gameManagerTransform = GameManager.instance.transform; terrainCollider = Terrain.activeTerrain.GetComponent <TerrainCollider>(); playerPlacementData = GameManager.instance.GetPlayer().GetPlacementData(); }
private void YShrink(Vector3 mouseWorldCoord) { float yBound = _verticalOrientation == Orientation.NORTH ? _maxPlacedY : _minPlacedY; PlacementData placementData = _subPlacerPrefab.toPlace; int placersToRemove = (int)(Mathf.Abs(mouseWorldCoord.y - yBound) / placementData.unitsHeight); for (int i = 1; i <= placersToRemove; i++) { LinkedList <BuildingPlacer> lineToRemove = _allPlacers.Last.Value; _allPlacers.RemoveLast(); int placementHeight = _subPlacerPrefab.toPlace.unitsHeight; if (_verticalOrientation == Orientation.NORTH) { _maxPlacedY -= placementHeight; } else if (_verticalOrientation == Orientation.SOUTH) { _minPlacedY += placementHeight; } foreach (BuildingPlacer toDelete in lineToRemove) { GameManager.instance.DestroyGameObject(toDelete.gameObject); _placersNber--; } } }
private void XShrink(Vector3 mouseWorldCoord) { float xBound = _horizontalOrientation == Orientation.EAST ? _maxPlacedX : _minPlacedX; PlacementData placementData = _subPlacerPrefab.toPlace; int placersToRemove = (int)(Mathf.Abs(mouseWorldCoord.x - xBound) / placementData.unitsWidth); for (int i = 1; i <= placersToRemove; i++) { foreach (LinkedList <BuildingPlacer> line in _allPlacers) { if (line.Count != 0)//La première ligne sera dans ce cas de temps à autre, puisque le placeur d'origine n'est pas dans les données de placement multiple { BuildingPlacer toDelete = line.Last.Value; line.RemoveLast(); GameManager.instance.DestroyGameObject(toDelete.gameObject); _placersNber--; } } int placementWidth = _subPlacerPrefab.toPlace.unitsWidth; if (_horizontalOrientation == Orientation.EAST) { _maxPlacedX -= placementWidth; } else if (_horizontalOrientation == Orientation.WEST) { _minPlacedX += placementWidth; } } }
private void ManageXOverflow(Vector3 mouseWorldCoord, string orientation, float xBound) { if (_horizontalOrientation != orientation) { DeletePlacers(); _horizontalOrientation = orientation; } int xMultiplier = _horizontalOrientation == Orientation.EAST ? 1 : -1; int yMultiplier = _verticalOrientation == Orientation.NORTH ? 1 : -1; PlacementData placementData = _subPlacerPrefab.toPlace; int placersToAdd = (int)(Mathf.Abs(mouseWorldCoord.x - xBound) / placementData.unitsWidth); /* * La condition de cette boucle vérifie qu'il faut encore ajouter une colonne * de placeurs et qu'on ne viole pas la limite de placeurs en l'ajoutant. */ for (int i = 1; i <= placersToAdd && _placersNber + _allPlacers.Count < maxPlacersNber; i++) { for (int y = 0; y < _allPlacers.Count; y++) { Vector3 newPosition = new Vector3(xBound + i * xMultiplier * placementData.unitsWidth, _initialPlacementCoord.y + y * yMultiplier * placementData.unitsHeight, _subPlacerPrefab.transform.position.z); BuildingPlacer newPlacer = CreateNewPlacer(newPosition); Enumerable.ElementAt(_allPlacers, y).AddLast(newPlacer); TakePlacerIntoAccount(newPlacer); } } }
public override void OnTriggerExit2D(Collider2D other) { PlacementData placementData = other.GetComponent <PlacementData>(); DungeonData dungeonData = other.GetComponent <DungeonData>(); if (placementData != null && dungeonData == null) { _collidingBuildings.Remove(placementData); } }
public PlayerData(string username) { this.username = username; this.earnedGold = 50; this.experiencePoints = 0; this.level = 1; this.health = 100; this.uptodate = false; this.placementData = new PlacementData(NumberOfFightingSpawns, NumberOfSubsSpawns, NumberOfEnemySpawns); }
public void TriggerBuildingPlacingFor(PlacementData toPlace) { GameManager gameManager = GameManager.instance; CityBuilderPlacingMode placingMode = GameModes.CITY_BUILDER_PLACING; if (!gameManager.isModeActive(placingMode)) { GameManager.instance.StackGameMode(placingMode); } placingMode.toPlace = toPlace; }
/// <summary> /// /// </summary> internal TagData() { Bounds = null; PlacementData = new PlacementData(new Rectangle()); //Placement Data should always be initialized, since RTL placement occurs even if no placement is set on the control. ShowTitleBar = true; ShowSystemMenu = true; ApplicationHookedDNeventsNames = null; HasCaret = true; #if !PocketPC TableControls = new ArrayList(); SelectingIdx = Int32.MinValue; #endif }
/// <summary> /// returns control rectangle /// </summary> /// <param name = "cellRect">rectangle of table's cell </param> /// <returns> </returns> public virtual Rectangle getDisplayRect(Rectangle cellRect, bool isHeaderEditor) { var rect = new Rectangle(0, 0, 0, 0); //if (_logicalControl is Line) // rect = ((Line)_logicalControl).calcDisplayRect(); //else { // compute rectangle relativly to table rect.Height = Height; rect.Width = Width; PlacementData placementData = _logicalControl.PlacementData; // apply X placement (depends on column width) Rectangle placementRect = placementData.Placement; ILogicalColumn columnManager = _tableManager.ColumnsManager.getLgColumnByMagicIdx(MgColumn); int dx = columnManager.getDx(); if (_tableManager.RightToLeftLayout) { int right = cellRect.Right - _xorigin; right -= dx * placementRect.X / 100; rect.Width += ((dx * placementRect.Width) / 100); rect.X = right - rect.Width; } else { rect.X = GetDisplayRectangleLeft(cellRect); rect.X += dx * placementRect.X / 100; rect.Width += ((dx * placementRect.Width) / 100); } // apply Y placement (depends on row height) // Defect 138536: For Header control, do not consider change in row height and hence do not consider placement for Y & Height int dy = isHeaderEditor ? 0 : _tableManager.GetChangeInRowHeight(); rect.Y = GetDisplayRectangleTop(cellRect); rect.Y += dy * placementRect.Y / 100; //Height of the 3D ComboBox is fixed and depends on the Font. //We cannot change it by setting the Height. //So, the Height placement is irrelevant. //Sets height only for 2D combobox if (!IsComboControl() || Is2DComboBoxControl()) { rect.Height += ((dy * placementRect.Height) / 100); } rect = _tableManager.GetTableMultiColumnStrategy(isHeaderEditor).GetRectToDraw(rect, cellRect); } return(rect); }
internal LogicalControl(GuiMgControl guiMgControl, Control containerControl) { this.GuiMgControl = guiMgControl; ZOrder = guiMgControl.ControlZOrder; _containerControl = containerControl; //this.mgRow = mgRow; _imeMode = -1; PlacementData = new PlacementData(new Rectangle()); InitializeContentAlignment(); WordWrap = true; //for edit this property will update according to the Horizontal scroll bar property Enabled = true; _text = null; TextSizeLimit = -1; // -1 to later indicate that the limit was not set. }
/// <summary> /// Placement Data of object /// </summary> /// <param name="obj"></param> /// <returns></returns> protected override PlacementData PlacementData(Object obj) { PlacementData placementData = null; if (obj is Control) { Control control = (Control)obj; if (control.Tag != null) { placementData = ((TagData)control.Tag).PlacementData; } } else { if (obj is LogicalControl) { LogicalControl staticControl = (LogicalControl)obj; placementData = staticControl.PlacementData; } } return(placementData); }
void OnPositionSelected() { onPlacementTask = false; infoPanel.SetActive(true); infoText.text = "Thank you for placing the platform."; platform.GetComponent <PlatformMover>().enabled = false; platform.GetComponent <Collider>().isTrigger = true; if (!onTraining) { //write data to file PlacementData placement = new PlacementData(); placement.participantID = participantID; placement.sessionNumber = sessionNumber; placement.blockID = blockID; placement.trajectoryPositions = platformTrajectoryPositions; placement.trajectoryTimeStamps = platformTrajectoryTimeStamps; placement.export(); } Invoke("StartBlock", delayBetweenTrials); }
private IEnumerator CollapseBuilding() { GameManager gameManager = GameManager.instance; gameManager.InstantiatePrefab(smokePrefab, transform.position); yield return(new WaitForSeconds(0.7f)); GameObject ruins = gameManager.InstantiatePrefab(ruinsPrefab, transform.position); //TODO: les lignes suivantes ne sont là que parce que pour l'instant, les ruines sont un quad avec texture répétée Vector2 newScale = new Vector2(placementData.unitsWidth, placementData.unitsHeight); ruins.transform.localScale = newScale; Material ruinsMaterial = ruins.GetComponent <MeshRenderer>().material; ruinsMaterial.mainTextureScale = newScale; PlacementData ruinsPlacementData = ruins.GetComponent <PlacementData>(); ruinsPlacementData.unitsHeight = placementData.unitsHeight; ruinsPlacementData.unitsWidth = placementData.unitsWidth; gameManager.DestroyGameObject(gameObject); }
protected void Awake() { placementData = GetComponent <PlacementData>(); buildingStock = GetComponent <BuildingStock>(); freightAreaData = GetComponent <FreightAreaData>(); }