Created
November 22, 2017 10:33
-
-
Save tenpn/46dd4edc1acba410f046f2a6a0878cbc to your computer and use it in GitHub Desktop.
fixed CustomSingleContextFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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