Esempio n. 1
0
    public Culture(string cultureName, Color cultureColor, Vector2 position, params CultureParameter[] parameter)
    {
        Name = cultureName;
        AddParameter(parameter);
        CultureColor  = cultureColor;
        StartPosition = position;

        BT_Culture = new BehaviourTree(this);

        //example Behaviour Tree
        BT_Selector selector = new BT_WeightedSelector("Start Selector",
                                                       new BT_WeightedSelector.WeightedPair(
                                                           GetParameterValue("Behaviour"),
                                                           new BT_Selector("Behaviour", new BT_Kill("Kill"), new BT_Claim("Claim: Behaviour", CultureType.Behaviour))),
                                                       new BT_WeightedSelector.WeightedPair(
                                                           GetParameterValue("Communication"),
                                                           new BT_Selector("Communication", new BT_Trade("Trade"), new BT_Reputation("Reputation: Communication", CultureType.Communication), new BT_Claim("Claim: Communication", CultureType.Communication))),
                                                       new BT_WeightedSelector.WeightedPair(
                                                           GetParameterValue("Economics"),
                                                           new BT_Selector("Economics", new BT_Reputation("Reputation: Economics", CultureType.Economics), new BT_Claim("Claim: Economics", CultureType.Economics))),
                                                       new BT_WeightedSelector.WeightedPair(
                                                           GetParameterValue("Sociology"),
                                                           new BT_Selector("Sociology", new BT_Reputation("Reputation: Sociology", CultureType.Sociology))));

        BT_Culture.Add(selector);
        //example Behaviour Tree

        Variables.PopulationSize = Random.Range(15, 30); //adding Start Population
    }
Esempio n. 2
0
 protected void Update()
 {
     if (Input.GetKeyDown(KeyCode.F5))
     {
         BehaviourTree bt       = new BehaviourTree(CultureManager.Instance.Cultures[0]);
         BT_Selector   selector = new BT_WeightedSelector("Start Selector",
                                                          new BT_WeightedSelector.WeightedPair(
                                                              CultureManager.Instance.Cultures[0].GetParameterValue("Behaviour"),
                                                              new BT_Selector("Behaviour", new BT_Kill("Kill"), new BT_Claim("Claim: Behaviour", CultureType.Behaviour))),
                                                          new BT_WeightedSelector.WeightedPair(
                                                              CultureManager.Instance.Cultures[0].GetParameterValue("Communication"),
                                                              new BT_Selector("Communication", new BT_Trade("Trade"), new BT_Reputation("Reputation: Communication", CultureType.Communication), new BT_Claim("Claim: Communication", CultureType.Communication))),
                                                          new BT_WeightedSelector.WeightedPair(
                                                              CultureManager.Instance.Cultures[0].GetParameterValue("Economics"),
                                                              new BT_Selector("Economics", new BT_Claim("Claim: Economics", CultureType.Economics), new BT_Reputation("Reputation: Economics", CultureType.Economics))),
                                                          new BT_WeightedSelector.WeightedPair(
                                                              CultureManager.Instance.Cultures[0].GetParameterValue("Sociology"),
                                                              new BT_Selector("Sociology", new BT_Reputation("Reputation: Sociology", CultureType.Sociology))));
         bt.Add(selector);
         Debug.Log("X");
         bt.Run();
     }
 }