public override void Start(RAIN.Core.AI ai) { base.Start(ai); GameObject agent = ai.Body; if (agent) { //String Expression 으로 찾을 Object 의 Type 을 가져온다 if (EnumType.IsValid) { objectType = (EObjectAttribute)Enum.Parse(typeof(EObjectAttribute), EnumType.Evaluate<string>(ai.DeltaTime, ai.WorkingMemory)); } } }
public ArrayList GetSeemObject(EObjectAttribute objectType) { ArrayList list = new ArrayList(); foreach (GameObject obj in GameObject.FindObjectsOfType<GameObject>()) { Component cpnt = obj.GetComponent<CObjectType>(); if (cpnt && ((CObjectType)cpnt).IsSameType(objectType)) { float dist = (gameObject.transform.position - obj.transform.position).magnitude; if (dist <= VisionRange) { list.Add(obj); } } } return list; }
public bool IsInType(EObjectAttribute Type) { return ((objectType & Type) != 0); }
public bool IsSameType(EObjectAttribute Type) { return (objectType == Type); }
public void ReserveType(EObjectAttribute Type) { objectType ^= Type; }
public void RemoveAllType() { objectType = EObjectAttribute.None; }
public void RemoveType(EObjectAttribute Type) { objectType &= ~Type; }
public void AddAllType() { objectType = EObjectAttribute.All; }
public void AddType(EObjectAttribute Type) { objectType |= Type; }