Skip to content

Instantly share code, notes, and snippets.

@tenpn
Created November 22, 2017 10:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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