public void Initialize() { _actions = new ActionCollection(); _considerations = new ConsiderationCollection(); _options = new OptionCollection(_actions, _considerations); _behaviours = new BehaviourCollection(_options); _aIs = new AiCollection(_behaviours); _ctor = new MasterAiConstructor(_aIs); }
public void Initialize() { _ac = new ActionCollection(); _cc = new ConsiderationCollection(); _oc = new OptionCollection(_ac, _cc); _bc = new BehaviourCollection(_oc); _aic = new AiCollection(_bc); var b = new Behaviour("b1", _bc); }
public void Initialize() { _actions = new ActionCollection(); _considerations = new ConsiderationCollection(); _options = new OptionCollection(_actions, _considerations); _behaviours = new BehaviourCollection(_options); _aIs = new AiCollection(_behaviours); _utilityAi = new UtilityAi("ai0", _aIs); }
/// <summary> /// Initializes a new instance of the <see cref="AiConstructor"/> class. /// </summary> /// <param name="collection">The collection.</param> /// <exception cref="Crystal.AiConstructor.AiCollectionNullException"></exception> protected AiConstructor(IAiCollection collection) { if (collection == null) { throw new AiCollectionNullException(); } AIs = collection; Initialize(); }
public void Inititalize() { _toon = new Toon(); _ac = new ActionCollection(); _cc = new ConsiderationCollection(); _oc = new OptionCollection(_ac, _cc); _bc = new BehaviourCollection(_oc); _aic = new AiCollection(_bc); // The main AI _ai = new UtilityAi("ai", _aic); var coreBehaviour = new Behaviour("coreBehaviour", _bc); coreBehaviour.Selector = new MaxUtilitySelector(); _ai.AddBehaviour(coreBehaviour.NameId); // Eat Option _eatOption = new Option(); _eatOption.Measure = new WeightedMetrics(1.4f); var eatAction = new EatAction(); var hungerConsideration = new HungerConsideration(); (_eatOption as Option).SetAction(eatAction); _eatOption.AddConsideration(hungerConsideration); _eatOption.AddConsideration(new InverseBladderConsideration()); coreBehaviour.AddConsideration(_eatOption); // Drink Option _drinkOption = new Option(); _drinkOption.Measure = new WeightedMetrics(3.0f); var drinkAction = new DrinkAction(); var thirstConsideration = new ThirstConsideration(); (_drinkOption as Option).SetAction(drinkAction); _drinkOption.AddConsideration(thirstConsideration); _drinkOption.AddConsideration(new InverseBladderConsideration()); // Toilet Option _toiletOption = new Option(); _toiletOption.Measure = new WeightedMetrics(); var toiletAction = new ToiletAction(); var bladderConsideration = new BladderConsideration(); (_toiletOption as Option).SetAction(toiletAction); _toiletOption.AddConsideration(bladderConsideration); coreBehaviour.AddConsideration(_eatOption); coreBehaviour.AddConsideration(_drinkOption); coreBehaviour.AddConsideration(_toiletOption); Console.WriteLine(coreBehaviour); _scheduler = new Scheduler(); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="other">The other.</param> UtilityAi(UtilityAi other) { NameId = other.NameId; _collection = other._collection; Initialize(); _selector = other._selector.Clone(); for (int i = 0; i < other._behaviours.Count; i++) { var b = other._behaviours[i].Clone() as Behaviour; _behaviours.Add(b); _behaviourUtilities.Add(b.Utility); } }
/// <summary> /// Initializes a new instance of the <see cref="AiTransition"/> class. /// </summary> /// <param name="nameId">The name identifier.</param> /// <param name="aiNameId">The ai name identifier.</param> /// <param name="collection">The collection.</param> /// <exception cref="Crystal.ActionBase.NameIdEmptyOrNullException"> /// </exception> public AiTransition(string nameId, string aiNameId, IAiCollection collection) : base(nameId, collection?.Actions) { if (string.IsNullOrEmpty(nameId)) { throw new NameIdEmptyOrNullException(); } if (string.IsNullOrEmpty(aiNameId)) { throw new NameIdEmptyOrNullException(); } NameId = nameId; _aiNameId = aiNameId; _aiCollection = collection; }
/// <summary> /// Initializes a new instance of the <see cref="UtilityAi"/> class. /// </summary> /// <param name="nameId">The name identifier.</param> /// <param name="collection">The collection.</param> /// <exception cref="Crystal.UtilityAi.NameIdIsNullOrEmptyException"></exception> /// <exception cref="Crystal.UtilityAi.AiCollectionNullException"></exception> /// <exception cref="Crystal.UtilityAi.AiAlreadyExistsInCollectionException"></exception> public UtilityAi(string nameId, IAiCollection collection) { if (string.IsNullOrEmpty(nameId)) { throw new NameIdIsNullOrEmptyException(); } if (collection == null) { throw new AiCollectionNullException(); } NameId = nameId; _collection = collection; Initialize(); if (_collection.Add(this) == false) { throw new AiAlreadyExistsInCollectionException(nameId); } }
/// <summary> /// Initializes a new instance of the <see cref="AiTransition"/> class. /// </summary> /// <param name="other">The other.</param> AiTransition(AiTransition other) : base(other) { _aiNameId = other._aiNameId; _aiCollection = other._aiCollection; }
public ExAiConstructor(IAiCollection collection) : base(collection) { }
public MasterAiConstructor(IAiCollection collection) : base(collection) { }
public HelperAiConstructor(IAiCollection collection) : base(collection) { }