private WoodStack GetClosest()
    {
        var stacks = COMPONENT_DATABASE.RetrieveComponents <WoodStack>();

        if (stacks.Count == 0)
        {
            return(null);
        }

        WoodStack closest     = null;
        float     closestDist = float.MaxValue;

        foreach (var stack in stacks)
        {
            float dist = (stack.gameObject.transform.position - transform.position).magnitude;

            if (dist < closestDist)
            {
                closest     = (WoodStack)stack;
                closestDist = dist;
            }
        }

        return(closest);
    }
Ejemplo n.º 2
0
    public override void SetTarget()
    {
        var closest = GetClosest();

        if (closest != null)
        {
            m_TargetDeposit = closest;
            target          = m_TargetDeposit.transform;
        }
    }
Ejemplo n.º 3
0
    private WoodStack GetClosest()
    {
        var trees = COMPONENT_DATABASE.RetrieveComponents <WoodStack>();

        WoodStack closest     = null;
        float     closestDist = float.MaxValue;

        foreach (var tree in trees)
        {
            float dist = (tree.gameObject.transform.position - transform.position).magnitude;

            if (dist < closestDist)
            {
                closest     = (WoodStack)tree;
                closestDist = dist;
            }
        }

        return(closest);
    }
Ejemplo n.º 4
0
 protected override void DoReset()
 {
     m_DepositedWood = false;
     m_TargetDeposit = null;
 }