So heres my code, no idea whats wrong.
When i walk up and click F i dont get any console errors and CarrotShouldBeDropped isnt checked and The carrot Doesnt Drop/appear
public class PlantGrow : MonoBehaviour {
public GameObject PhaseOne;
public GameObject PhaseTwo;
public GameObject PhaseThree;
public GameObject Seed;
public bool IsPhaseOne;
public bool IsPhaseTwo;
public bool IsPhaseThree;
public bool IsSeed;
public bool IsInRadius;
public GameObject CarrotDropped;
public GameObject HarvestUI;
public bool CarrotShouldBeDropped;
// Use this for initialization
void Start ()
{
PhaseOne.SetActive (true);
Invoke ("Seed1", 0.0f);
Invoke("Phase1", 5.0f);
Invoke("Phase2", 10.0f);
Invoke("Phase3", 25.0f);
}
// Update is called once per frame
void Update () {
}
void Seed1()
{
Seed.SetActive (true);
IsSeed = true;
IsPhaseOne = false;
IsPhaseTwo = false;
IsPhaseThree = false;
PhaseOne.SetActive (false);
PhaseTwo.SetActive (false);
PhaseThree.SetActive (false);
}
void Phase1()
{
Seed.SetActive (false);
IsSeed = false;
IsPhaseOne = true;
IsPhaseTwo = false;
IsPhaseThree = false;
PhaseOne.SetActive (true);
PhaseTwo.SetActive (false);
PhaseThree.SetActive (false);
}
void Phase2()
{
IsSeed = false;
IsPhaseTwo = true;
IsPhaseOne = false;
IsPhaseThree = false;
PhaseTwo.SetActive (true);
PhaseOne.SetActive (false);
PhaseThree.SetActive (false);
}
void Phase3()
{
IsSeed = false;
IsPhaseThree = true;
IsPhaseOne = false;
IsPhaseTwo = false;
PhaseTwo.SetActive (false);
PhaseOne.SetActive (false);
PhaseThree.SetActive (true);
}
void OnTriggerEnter(Collider other)
{
IsInRadius = true;
if (IsPhaseThree = true && IsInRadius == true) {
HarvestUI.SetActive (true);
}
if (Input.GetKeyDown (KeyCode.F) && IsInRadius == true) {
CarrotDropped.SetActive (true);
PhaseThree.SetActive (false);
CarrotShouldBeDropped = true;
}
}
void OnTriggerExit(Collider other)
{
HarvestUI.SetActive (false);
IsInRadius = false;
}
}