Guest User

Untitled

a guest
Nov 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using TenPN.DecisionFlex;
  5. using System;
  6.  
  7. public class CustomSingleContextFactory : SingleContextFactory
  8. {
  9.  
  10. public override IContext SingleContext(Logging loggingSetting)
  11. {
  12. ContextDictionary masterContext = new ContextDictionary();
  13.  
  14. float distToPlayer = Player.DistanceTo(transform.root.position);
  15.  
  16. masterContext.SetContext("PlayerPosition", Player.position);
  17. masterContext.SetContext("DistanceToPlayer", distToPlayer);
  18.  
  19.  
  20. if(loggingSetting == Logging.Enabled)
  21. {
  22. //Debug.Log("My distance to the player: " + distToPlayer);
  23. }
  24.  
  25. return masterContext;
  26. }
  27. }
Add Comment
Please, Sign In to add comment