*
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public static class BlackboardVariables {
|
||||
public static string LastEnemyPosition = "lastEnemyPosition";
|
||||
public static string LastSound = "lastSound";
|
||||
public static string LastSuspiciousTime = "lastSuspTime";
|
||||
public static string Enemy = "enemy";
|
||||
}
|
||||
|
||||
|
||||
public class AiBlackboard : MonoBehaviour {
|
||||
private Dictionary<string, object> _values = new Dictionary<string, object>();
|
||||
|
||||
public GameObject Obj {
|
||||
get {
|
||||
return (GameObject)_values["gameobject"];
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(string key, object val) {
|
||||
_values[key] = val;
|
||||
}
|
||||
|
||||
/*public bool GetValue(string key, out object val) {
|
||||
if (_values.ContainsKey(key)) {
|
||||
val = _values[key];
|
||||
return true;
|
||||
}
|
||||
val = null;
|
||||
return false;
|
||||
}*/
|
||||
|
||||
public bool GetValue<T>(string key, out T obj) {
|
||||
if (_values.ContainsKey(key)) {
|
||||
obj = (T)_values[key];
|
||||
return true;
|
||||
}
|
||||
obj = default(T);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool RemoveValue(string key) {
|
||||
return _values.Remove(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user