public void SwitchRotation() { selectedRotation = selectedRotation.Next(); if (state != Modes.SetObject || !Phantom.IsDisplayed()) { return; } CellController cellPrefab = selectedPrefab.GetComponent <CellController>(); cellPrefab.PrefabValidatePosition(M, Phantom.LastPhantomPosition, selectedRotation); }
// Use this for initialization void Start() { CellController cell = GetComponent <CellController>(); CellController.CellRotation rotation = CellController.CellRotation.None; if (Autorotate && cell.SizeX == 1 && cell.SizeY == 1) { WallController bl = M.House.GetWall(new WallPoint(cell.Position.X, cell.Position.Y)); WallController tr = M.House.GetWall(new WallPoint(cell.Position.X + 1, cell.Position.Y + 1)); if (bl != null) { if (bl.wallSprite.Right) { rotation = CellController.CellRotation.None; } else if (bl.wallSprite.Top) { rotation = CellController.CellRotation.C90; } } if (tr != null) { if (tr.wallSprite.Left) { rotation = CellController.CellRotation.C180; } else if (tr.wallSprite.Bottom) { rotation = CellController.CellRotation.C270; } } cell.SetRotation(rotation); /*M.House.ForEachWall(cell.Position, (WallPoint wp, WallController wc, Corner corner) =>{ * switch(corner) * { * case Corner.BottomLeft: * if( * break; * case Corner.BottomRight: * break; * case Corner.TopLeft: * break; * case Corner.TopRight: * break; * } * });*/ } }
public void SwitchRotation() { selectedRotation = selectedRotation.Next(); if(state!=Modes.SetObject || !Phantom.IsDisplayed()) return; CellController cellPrefab = selectedPrefab.GetComponent<CellController>(); cellPrefab.PrefabValidatePosition(M,Phantom.LastPhantomPosition,selectedRotation); }