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 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); }