void Start() { BuildingSensor.AddBuilding(this); GameObject farmerPrefab = Resources.Load("Prefabs/Farmer") as GameObject; GameObject.Instantiate(farmerPrefab, this.transform.position, this.transform.rotation); }
public void OnBuildHouseCommandIssued() { Vector3 nearestPossibleNewHouseLocation = BuildingSensor.FindNearestBuildSpot(BuildingTypes.HOUSE, this.transform); if (nearestPossibleNewHouseLocation != null) { float step = this.speed * Time.deltaTime; this.transform.position = Vector3.MoveTowards(this.transform.position, nearestPossibleNewHouseLocation, step); } }
public void OnBuyWeaponCommandIssued() { Building nearestPossibleShop = BuildingSensor.FindNearest(BuildingTypes.SHOP, this.transform); if (nearestPossibleShop != null && nearestPossibleShop is Shop && nearestPossibleShop is MonoBehaviour) { MonoBehaviour shopBehaviour = nearestPossibleShop as MonoBehaviour; float step = this.speed * Time.deltaTime; this.transform.position = Vector3.MoveTowards(this.transform.position, shopBehaviour.transform.position, step); } }
public void OnFarmCommandIssued() { Building nearestPossibleFarm = BuildingSensor.FindNearest(BuildingTypes.FARM, this.transform); if (nearestPossibleFarm != null && nearestPossibleFarm is Farm && nearestPossibleFarm is MonoBehaviour) { MonoBehaviour farmBehaviour = nearestPossibleFarm as MonoBehaviour; float step = this.speed * Time.deltaTime; this.transform.position = Vector3.MoveTowards(this.transform.position, farmBehaviour.transform.position, step); } }
public bool IsBuildHouseCommandCompleted() { Vector3 nearestPossibleNewHouseLocation = BuildingSensor.FindNearestBuildSpot(BuildingTypes.HOUSE, this.transform); if (nearestPossibleNewHouseLocation != null) { Vector3 vectorToHouseLocation = transform.position - nearestPossibleNewHouseLocation; return(vectorToHouseLocation.magnitude <= 1.0f); } return(false); }
public bool IsBuyWeaponCommandCompleted() { Building nearestPossibleShop = BuildingSensor.FindNearest(BuildingTypes.SHOP, this.transform); if (nearestPossibleShop != null && nearestPossibleShop is Shop && nearestPossibleShop is MonoBehaviour) { MonoBehaviour shopBehaviour = nearestPossibleShop as MonoBehaviour; Vector3 vectorToShop = transform.position - shopBehaviour.transform.position; return(vectorToShop.magnitude <= 1.0f); } return(false); }
public bool IsFarmCommandComplete() { Building nearestPossibleFarm = BuildingSensor.FindNearest(BuildingTypes.FARM, this.transform); if (nearestPossibleFarm != null && nearestPossibleFarm is Farm && nearestPossibleFarm is MonoBehaviour) { MonoBehaviour farmBehaviour = nearestPossibleFarm as MonoBehaviour; Vector3 vectorToFarm = transform.position - farmBehaviour.transform.position; return(vectorToFarm.magnitude <= 1.0f); } return(false); }
void Start() { BuildingSensor.AddBuilding(this); }