Beispiel #1
0
 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
         }
     }
 }
Beispiel #2
0
 // 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;
 }
Beispiel #3
0
    private void Start()
    {
        photonView    = GameObject.Find("QuickStartRoomController").GetComponent <PhotonView>();
        waterCollider = GetComponent <Collider>();
        waterSpray    = transform.GetChild(0).GetComponent <ParticleSystem>();

        farmerController = GameObject.Find("QuickStartRoomController").GetComponent <FarmerController>();
    }
Beispiel #4
0
    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);
    }
Beispiel #5
0
 void Awake()
 {
     if (_instance != null)
     {
         throw new Exception("FarmerController is not null.");
     }
     _instance     = this;
     dataDirectory = Application.persistentDataPath + "/data";
     Directory.CreateDirectory(dataDirectory);
     load();
 }
Beispiel #6
0
    private bool hasScythe  = false; // Player has obtained scythe


    void Awake()
    {
        instance = this;
    }