public void AddBacon(string name) { //print ("inside AddBacon()"); if (gameObject.name == name) { //print ("adding the bacon"); currentState = cookingStates.raw; cookStartTime = Time.time; hasBacon = true; baconBuffer = true; newBaconTime = Time.time + newBaconBuffer; baconCount++; } }
public void TakeBacon(string name) { if (gameObject.name == name) { //print("your bacon got took"); currentState = cookingStates.empty; hasBacon = false; } else if (name == "") { currentState = cookingStates.empty; hasBacon = false; } }
// Update is called once per frame void Update() { //t_animator = target.GetComponent<Animator> (); switch (currentState) { case cookingStates.empty: t_animator.SetInteger("cookSpot_int", 0); b_animator.SetInteger("bacon_animation", -1); c_animator.SetInteger("cfx_int", 0); rotationAmount = 0f; smokeParticle.SetActive(false); ParticleSystemRenderer pr = smokeParticle.GetComponent<ParticleSystemRenderer>(); pr.material = mat1; break; case cookingStates.raw: b_animator.SetInteger("bacon_animation", 0); t_animator.SetInteger("cookSpot_int", 1); c_animator.SetInteger("cfx_int", 1); rotationAmount = 0.4f; break; case cookingStates.undercooked: b_animator.SetInteger("bacon_animation", 0); t_animator.SetInteger("cookSpot_int", 2); c_animator.SetInteger("cfx_int", 1); rotationAmount = 0.7f; break; case cookingStates.almost: b_animator.SetInteger("bacon_animation", 1); t_animator.SetInteger("cookSpot_int", 3); c_animator.SetInteger("cfx_int", 2); rotationAmount = 1f; break; case cookingStates.perfect: b_animator.SetInteger("bacon_animation", 2); t_animator.SetInteger("cookSpot_int", 4); c_animator.SetInteger("cfx_int", 2); rotationAmount = 1.5f; break; case cookingStates.crispy: b_animator.SetInteger("bacon_animation", 3); t_animator.SetInteger("cookSpot_int", 5); c_animator.SetInteger("cfx_int", 3); rotationAmount = 2f; smokeParticle.SetActive(true); ParticleSystemRenderer prc = smokeParticle.GetComponent<ParticleSystemRenderer>(); prc.material = mat1; break; case cookingStates.burnt: b_animator.SetInteger("bacon_animation", 4); t_animator.SetInteger("cookSpot_int", 6); c_animator.SetInteger("cfx_int", 4); rotationAmount = 3f; ParticleSystemRenderer prb = smokeParticle.GetComponent<ParticleSystemRenderer>(); prb.material = mat2; break; } if (Time.time > cookStartTime + (cookSpeed * 5) && currentState == cookingStates.raw) { currentState = cookingStates.undercooked; } if (Time.time > cookStartTime + (cookSpeed * 8) && currentState == cookingStates.undercooked) { currentState = cookingStates.almost; } if (Time.time > cookStartTime + (cookSpeed * 11) && currentState == cookingStates.almost) { currentState = cookingStates.perfect; } if (Time.time > cookStartTime + (cookSpeed * 14) && currentState == cookingStates.perfect) { currentState = cookingStates.crispy; } if (Time.time > cookStartTime + (cookSpeed * 17) && currentState == cookingStates.crispy) { currentState = cookingStates.burnt; } if (Time.time > cookStartTime + (cookSpeed * 20) && currentState == cookingStates.burnt) { currentState = cookingStates.empty; hasBacon = false; } if (Time.time > newBaconTime) { baconBuffer = false; } }