public virtual void CreateFarmer() { if (FoodAmount >= farmerCost) { FoodAmount = -farmerCost; farmers++; NewGameController.Instance.TeamSize[teamID] += 1; if (FarmerPool.Count > 0) //Are there any farmer bots already? { FarmerController recycle = FarmerPool.Find(f => !f.isActive); //are there inactive bots? if (recycle != null) { //reycycle.RpsSetMom recycle.SetMoM(this.gameObject); recycle.transform.position = Location + new Vector3(1, 0, 1); } else { InstantiateFarmer(); //No inactives we can recycle } } else { InstantiateFarmer(); //No Bots available yet } } }
// Start is called before the first frame update void Start() { hoverMap = GetComponent <Tilemap>(); grid = hoverMap.layoutGrid; groundMap = grid.transform.Find("Tilemap").gameObject.GetComponent <Tilemap>(); farmer = FarmerController.instance; }
private void Start() { photonView = GameObject.Find("QuickStartRoomController").GetComponent <PhotonView>(); waterCollider = GetComponent <Collider>(); waterSpray = transform.GetChild(0).GetComponent <ParticleSystem>(); farmerController = GameObject.Find("QuickStartRoomController").GetComponent <FarmerController>(); }
protected void InstantiateFarmer() { GameObject spawn = Instantiate(farmerFab, SpawnMouth, FaceForward) as GameObject; FarmerController fc = spawn.GetComponent <FarmerController>(); NetworkServer.Spawn(spawn); fc.SetMoM(this.gameObject); FarmerPool.Add(fc); }
void Awake() { if (_instance != null) { throw new Exception("FarmerController is not null."); } _instance = this; dataDirectory = Application.persistentDataPath + "/data"; Directory.CreateDirectory(dataDirectory); load(); }
private bool hasScythe = false; // Player has obtained scythe void Awake() { instance = this; }