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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <CookingStation>(this); }
public override bool CheckProceduralPrecondition() { return(COMPONENT_DATABASE.RetrieveComponents <BlacksmithResourceDeposit>().Count > 0); }
void OnEnable() { COMPONENT_DATABASE.Register <EnemyHealth>(this); m_CurrentHitPoints = hitPoints; }
void OnDisable() { COMPONENT_DATABASE.UnRegister <EnemyHealth>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <AnimalHealth>(this); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <Meat>(this); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <WoodStack>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <BlacksmithForge>(this); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <BlacksmithForge>(this); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <ToolDispenser>(this); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <AnimalHealth>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <CookingStation>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <CutableTree>(this); }
public override bool CheckProceduralPrecondition() { return(COMPONENT_DATABASE.RetrieveComponents <MeatTable>().Count > 0); }
void OnEnable() { COMPONENT_DATABASE.Register <Meat>(this); }
public override bool RequiresInRange() { return(COMPONENT_DATABASE.RetrieveComponents <EnemyHealth>().Count > 0 ? false : true); }
void OnDisable() { COMPONENT_DATABASE.UnRegister <CutableTree>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <WoodStack>(this); }
void OnEnable() { COMPONENT_DATABASE.Register <BlacksmithResourceDeposit>(this); }