Here is what i want to do based on how i understand, AC, and it is what i Need to do to please my professor,
As you've known I am making A Farm Simulation Game so that means CROPS,
here is what i want to do with crops
first, When i plant their seeds, I want it to make its own "Time left to Harvest" Variable when it reaches "0" then i can harvest it,
there are a total of 30 farm plots so far that i can plant on and 5 different Crops so far.. does that mean 30*5= 150 different variables? Can Anyone please help me for each and every detail,
=
For example i want my carrot Seeds to be harvested at 8 hours in game time, so i need to have a timer for each instance my carrot seed is planted, so that it will run differently and be harvested at different times, that is my main problem now
==
, help me please
everybody on this community
second, I want my crops prefab scale to grow by a certain number every instance that a certain number of time is deducted to the "Time left to Harvest" Variable of a certain specific crop i have planted, to make a "Growing Crop effect"
last but not the least, How can i Change or Swap my crop prefab with another fully grown crop prefab once the "Time left to Harvest" Variable is 0 to show that its fully grown,
that is all i ask for now thank you so very much you would save my life and my future if you answer this thank you thank you no words can express my thanks if you'll help me
Comments
1) Yes, you will need one variable per crop.
2/3) Attach a custom script to each crop. This should get you going - you might have to tweak the numbers. In the Inspector, give appropriate values each of the exposed properties (ID values are the number next to each Variable in the Variables Manager). The current crop model (oldPrefab) should be a child object, so that it can be removed without deleting the whole thing.
using UnityEngine;
using System.Collections;
using AC;
public class CropGro : MonoBehaviour
{
public int inventoryID;
public float timeToGrow;
public GameObject newPrefab;
public GameObject oldPrefab;
private void Update ()
{
float timeLeft = GlobalVariables.GetFloatValue (inventoryID);
float size = 1f + ((timeToGrow - timeLeft) / timeToGrow);
transform.localScale = new Vector3 (size, size, size);
if (timeLeft <= 0f)
{
Destroy (oldPrefab);
Instantiate (newPrefab, transform.position, Quaternion.identity);
}
}
}
1. How do i spawn that crop(with the attached script) via the hotspot on my farm plot? or do i just make a Call Custom Script on the actionlist i've used on the hotspot on my plots?
because here is how i've made my planting effect before:
===
First, i've made alot of planted carrotseeds (my beta Crop) at a very far away place from my game area, when the player clicks the hotspot with the required seed, it will be teleported to the marker at the specific farm plot i have put on there,
Then with that, after a day(in-game) has passed, it will automatically move to another far far away place then it will be replaced with a full grown carrot,
..but my "client/prof" wanted it to grow by scale not instantly so thats when i have come to you,, my game is 80% finished everything is working, i've set up shops via dialogues and conversations, i've set up animals, NPCs, Sleeping, and such.. all that i need is this planting logic, sorry if i am such a nag or a disturbance to you i am very stuck may you please help me im