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

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

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

        foreach (var s in stacks)
        {
            var stack = (MeatTable)s;

            if (stack.count <= 0)
            {
                continue;
            }

            float dist = (stack.gameObject.transform.position - transform.position).magnitude;

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

        return(closest);
    }
Esempio n. 2
0
    private AnimalHealth GetClosest()
    {
        var health = COMPONENT_DATABASE.RetrieveComponents <AnimalHealth>();

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

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

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

            if (dist < closestDist)
            {
                closest     = (AnimalHealth)ah;
                closestDist = dist;
            }
        }

        return(closest);
    }
    private ToolDispenser GetClosest()
    {
        var dispensers = COMPONENT_DATABASE.RetrieveComponents <ToolDispenser>();

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

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

        foreach (var d in dispensers)
        {
            var dispenser = (ToolDispenser)d;
            if (dispenser.GetResourceCount(ToolType.WoodenAxe) <= 0)
            {
                continue;
            }

            float dist = (dispenser.gameObject.transform.position - transform.position).magnitude;

            if (dist < closestDist)
            {
                closest     = dispenser;
                closestDist = dist;
            }
        }

        return(closest);
    }
Esempio n. 4
0
    private BlacksmithResourceDeposit GetClosest()
    {
        var stacks = COMPONENT_DATABASE.RetrieveComponents <BlacksmithResourceDeposit>();

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

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

        foreach (var s in stacks)
        {
            var stack = (BlacksmithResourceDeposit)s;

            if (stack.logs <= 0)
            {
                continue;
            }

            float dist = (stack.gameObject.transform.position - transform.position).magnitude;

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

        return(closest);
    }
Esempio n. 5
0
    private CookingStation GetClosest()
    {
        var stations = COMPONENT_DATABASE.RetrieveComponents <CookingStation>();

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

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

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

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

        return(closest);
    }
Esempio n. 6
0
    private EnemyHealth GetClosest()
    {
        var stacks = COMPONENT_DATABASE.RetrieveComponents <EnemyHealth>();

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

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

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

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

        return((EnemyHealth)closest);
    }
Esempio n. 7
0
    private CutableTree GetClosest()
    {
        var trees = COMPONENT_DATABASE.RetrieveComponents <CutableTree>();

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

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

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

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

        return(closest);
    }
    public override bool CheckProceduralPrecondition()
    {
        var tables = COMPONENT_DATABASE.RetrieveComponents <MeatTable>();

        foreach (var s in tables)
        {
            var table = (MeatTable)s;

            if (table.count > 0)
            {
                return(true);
            }
        }

        return(false);
    }
Esempio n. 9
0
    private MeatTable GetClosest()
    {
        var tables = COMPONENT_DATABASE.RetrieveComponents <MeatTable>();

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

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

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

        return(closest);
    }
Esempio n. 10
0
    private BlacksmithResourceDeposit GetClosest()
    {
        var trees = COMPONENT_DATABASE.RetrieveComponents <BlacksmithResourceDeposit>();

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

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

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

        return(closest);
    }
Esempio n. 11
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);
    }
Esempio n. 12
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <CookingStation>(this);
 }
Esempio n. 13
0
 public override bool CheckProceduralPrecondition()
 {
     return(COMPONENT_DATABASE.RetrieveComponents <BlacksmithResourceDeposit>().Count > 0);
 }
Esempio n. 14
0
    void OnEnable()
    {
        COMPONENT_DATABASE.Register <EnemyHealth>(this);

        m_CurrentHitPoints = hitPoints;
    }
Esempio n. 15
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <EnemyHealth>(this);
 }
Esempio n. 16
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <AnimalHealth>(this);
 }
Esempio n. 17
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <Meat>(this);
 }
Esempio n. 18
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <WoodStack>(this);
 }
Esempio n. 19
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <BlacksmithForge>(this);
 }
Esempio n. 20
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <BlacksmithForge>(this);
 }
Esempio n. 21
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <ToolDispenser>(this);
 }
Esempio n. 22
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <AnimalHealth>(this);
 }
Esempio n. 23
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <CookingStation>(this);
 }
Esempio n. 24
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <CutableTree>(this);
 }
Esempio n. 25
0
 public override bool CheckProceduralPrecondition()
 {
     return(COMPONENT_DATABASE.RetrieveComponents <MeatTable>().Count > 0);
 }
Esempio n. 26
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <Meat>(this);
 }
Esempio n. 27
0
 public override bool RequiresInRange()
 {
     return(COMPONENT_DATABASE.RetrieveComponents <EnemyHealth>().Count > 0 ? false : true);
 }
Esempio n. 28
0
 void OnDisable()
 {
     COMPONENT_DATABASE.UnRegister <CutableTree>(this);
 }
Esempio n. 29
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <WoodStack>(this);
 }
Esempio n. 30
0
 void OnEnable()
 {
     COMPONENT_DATABASE.Register <BlacksmithResourceDeposit>(this);
 }