public CustomAnthillFactory(int boardSize, int queenNb, int foodNb, LocationMethod queenLocationMethod) { CustomBoardSize = boardSize; CustomQueenNumber = queenNb < 1 ? 1 : (queenNb > 5 ? 5 : queenNb); CustomFoodNumber = foodNb; CustomQueenStartMethod = queenLocationMethod; }
public static LocationFactory CorrespondingFactory(LocationMethod method) { switch (method) { case LocationMethod.Border: return(BorderLocationFactory.Instance); case LocationMethod.Random: default: return(RandomLocationFactory.Instance); } }
private Vector3 GetLocation(LocationMethod method) { switch (method) { case LocationMethod.PlayerForward: Entity player = PinouApp.Entity.Player; if (player != null) { return(player.Position + player.Forward * _forwardOffset); } break; case LocationMethod.RayCastMouse: throw new System.Exception("To implement"); case LocationMethod.Mouse2d: return(Camera.main.ScreenToWorldPoint(Input.mousePosition).SetZ(0f)); } return(Vector3.zero); }
public GameBuilder queenStartMethod(LocationMethod queenStartMethod) { QueenStartMethod = queenStartMethod; return(this); }
public List <LocationMethod> getLocationMethods() { List <LocationMethod> locationMethods = new List <LocationMethod>(); SelectResult selectResult = null; try { String sql = "SELECT CODE, LONGTEXT FROM CODE WHERE CODETYPE = 64"; Debug.Log("Jupiter Lokation Metoder SQL: " + sql); selectResult = jupiterClient.select(sql); } catch (System.ServiceModel.CommunicationException e) { Debug.Log("Too many results"); } if (selectResult != null) { if (selectResult.DataSetResult != null) { foreach (DataTable table in selectResult.DataSetResult.Tables) { String[] columnNames = new String[table.Columns.Count]; for (int i = 0; i < table.Columns.Count; i++) { columnNames[i] = table.Columns[i].ColumnName; } foreach (System.Data.DataRow row in table.Rows) { object[] itemArray = row.ItemArray; LocationMethod locationMethod = new LocationMethod(); for (int i = 0; i < itemArray.Length; i++) { switch (columnNames[i]) { case "CODE": locationMethod.Code = Convert.ToString(itemArray[i]); break; case "LONGTEXT": locationMethod.Description = Convert.ToString(itemArray[i]); break; default: Debug.Log("Unidentified Column!"); break; } } locationMethods.Add(locationMethod); } } } else { Debug.Log("SelectResult's DataSetResult is null"); } if (selectResult.Error != null) { string error = selectResult.Error; Debug.Log("Error getting LocationQualities: " + error); } } else { Debug.Log("SelectResult is null"); } return(locationMethods); }