public override DecisionTreeNode GetBranch() { // targetPersonality = this.GetComponent<DecisionTreeCreator>().target.GetComponent<AIPersonality>(); switch (actualDecisionType) { case FloatDecisionTypes.HEALTH: if (maxValue >= characterPersonality.health && characterPersonality.health >= minvalue) { return(nodeTrue); } break; case FloatDecisionTypes.FEAR: if (maxValue >= characterPersonality.fear && characterPersonality.fear >= minvalue) { return(nodeTrue); } break; case FloatDecisionTypes.AGGRESSIVENESS: if (maxValue >= characterPersonality.selfAssertion && characterPersonality.selfAssertion >= minvalue) { return(nodeTrue); } break; case FloatDecisionTypes.CONFIDENCEINOTHER: int value = characterPersonality.TrustInOthers[targetPersonality.GetMyOwnIndex()]; if (maxValue >= value && value >= minvalue) { return(nodeTrue); } break; case FloatDecisionTypes.CHARISMA: if (maxValue >= characterPersonality.charisma && characterPersonality.charisma >= minvalue) { return(nodeTrue); } break; } return(nodeFalse); }
public override void Start() { // Debug.Log("start dec tree creator"); //target = this.gameObject; //just to create the decisiontree myPersonality = this.gameObject.GetComponent <AIPersonality>(); if (target.tag == "Player") { targetPersonality = target.gameObject.GetComponent <PlayerPersonality>(); } else { targetPersonality = target.gameObject.GetComponent <AIPersonality>(); } indexCharacterInteractedWithMe = targetPersonality.GetMyOwnIndex(); myTrustInOther = myPersonality.TrustInOthers[indexCharacterInteractedWithMe]; CreateTree(); }