Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fixed CustomSingleContextFactory
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TenPN.DecisionFlex;
using System;
public class CustomSingleContextFactory : SingleContextFactory
{
public override IContext SingleContext(Logging loggingSetting)
{
ContextDictionary masterContext = new ContextDictionary();
float distToPlayer = Player.DistanceTo(transform.root.position);
masterContext.SetContext("PlayerPosition", Player.position);
masterContext.SetContext("DistanceToPlayer", distToPlayer);
if(loggingSetting == Logging.Enabled)
{
//Debug.Log("My distance to the player: " + distToPlayer);
}
return masterContext;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.