예제 #1
0
 public CustomAnthillFactory(int boardSize, int queenNb, int foodNb, LocationMethod queenLocationMethod)
 {
     CustomBoardSize        = boardSize;
     CustomQueenNumber      = queenNb < 1 ? 1 : (queenNb > 5 ? 5 : queenNb);
     CustomFoodNumber       = foodNb;
     CustomQueenStartMethod = queenLocationMethod;
 }
예제 #2
0
        public static LocationFactory CorrespondingFactory(LocationMethod method)
        {
            switch (method)
            {
            case LocationMethod.Border:
                return(BorderLocationFactory.Instance);

            case LocationMethod.Random:
            default:
                return(RandomLocationFactory.Instance);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
 public GameBuilder queenStartMethod(LocationMethod queenStartMethod)
 {
     QueenStartMethod = queenStartMethod;
     return(this);
 }
예제 #5
0
    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);
    }