예제 #1
0
    // Something like: <highTemperature, Taste> -> true
    //				   <cryThreeTimesInRow, Hunger> -> true
    //					etc.



    // - matches Rules, needs and true/false

    // - - list of needs
    //public List<Need> needs;
    // - - list of

    // This should be a list of Needs (Attempt Satisfy Needs)
    public void AttemptSatisfy(Need need, float increaseRate, string ruleName)
    {
        //get component by name (ruleName)
        //Rule rule = this.FindObjectsOfType<typeof(Rule)>().ToList().Find( x=>x.name == ruleName + " Rule");

        Rule rule = rules.Find(x => x.ruleName == ruleName);

        //Rule rule = rules[0];

        //Rule rule = GameObject.Find(ruleName + " Rule").GetComponent<Rule>();

        //Rule rule = GameObject.Find( x => x.name == (ruleName + " Rule"));
        //Rule rule = this.FindObjectsOfType<typeof(Rule)>()


        if (rule.isSatisfied(need))
        {
            need.Satisfy(increaseRate);
        }

        // if (satisfactionRules.AttemptSatisfy(asphyx, "Breathe")){ // maybe later get name from function name
        //	//asphyx.Satisfy(breathingRate);
        //}
    }