Beispiel #1
0
        public void SetConfig(string item, string value)
        {
            ItemValue iv = new ItemValue();

            iv.SetValue(this, item, value);
            // this -> Configurtaion 객체를 가르킴
        }
Beispiel #2
0
    protected override bool InnerIsFulfilled()
    {
        // set the position from where to check
        Vector3 position;

        if (positionValue == null) // if the positionValue is null then use the toy
        {
            position = tree.AttachedBrain.transform.position;
        }
        else
        {
            // If there was no position inside the value then return fals
            if (positionValue.TryGetValue(out position) == false)
            {
                return(false);
            }
        }

        // Get all colliders and look if any of them are Items. Get the closest one
        Collider[]  colls    = Physics.OverlapSphere(position, distanceToCheck);
        float       closest  = float.MaxValue;
        ItemInWorld bestItem = null;

        for (int i = 0; i < colls.Length; i++)
        {
            if (colls[i].TryGetComponent(out ItemInWorld item) == true)
            {
                float newDistance = (position - item.transform.position).sqrMagnitude;
                if (newDistance < closest)
                {
                    bestItem = item;
                    closest  = newDistance;
                }
            }
        }

        // If no item was found return false
        if (bestItem == null)
        {
            return(false);
        }

        // Set the itemValue and return true
        itemValue.SetValue(bestItem);
        return(true);
    }
Beispiel #3
0
        List <ItemValue> listConfig = new List <ItemValue>();     //itemvalue의 리스트형식
        public void SetConfig(string item, string value)
        {
            ItemValue iv = new ItemValue();

            iv.SetValue(this, item, value);
        }
Beispiel #4
0
        public void SetConfig(string p_sItem, string p_sValue)
        {
            ItemValue iv = new ItemValue();

            iv.SetValue(this, p_sItem, p_sValue);
        }