void OnClickResourceEvent(ClickResourceEvent e) { if (e.resource is InvasiveReedBehavior) { // roots.SetActive (enabled); } // if (e.resource is GrassBehavior) { // if (accessFuel.GetComponent<Fuel>().currentfuel >= 2) { // // } else { // Debug.Log ("NO!"); // //play reject sound // //reject message // } // } // if (e.resource is OilBehavior) { // if (accessFuel.GetComponent<Fuel>().currentfuel < accessFuel.GetComponent<Fuel>().maxfuel) { // // } else { // Debug.Log ("NO!"); // // //play reject sound // //reject message // } // } if (e.resource is MangroveBehavior) { } if (e.resource is TrashBehavior) { } // if (e.resource is BigTrashBehavior) // { // // } // if (e.resource is PalmBehavior) // { // // } }
void OnClickResourceEvent(ClickResourceEvent e) { if (e.resource is GrassBehavior) { Debug.Log("hi"); GrassInfo.SetActive(true); } if (e.resource is OilBehavior) { OilInfo.SetActive(true); } if (e.resource is MangroveBehavior) { MangroveInfo.SetActive(true); } if (e.resource is TrashBehavior) { TrashInfo.SetActive(true); } if (e.resource is PalmBehavior) { PalmInfo.SetActive(true); } }
// void OnTriggerEnter(Collider other) { // if (other.tag == "ShallowOcean") { // Debug.Log ("in ocean"); // inWater = true; // //Health (-1); // } // if (other.tag == "DeepOcean") { // Debug.Log ("in deep ocean"); // inDeepWater = true; // //Health (-2); // } // if (other.tag == "ground" && currenthealth < maxhealth) { // Debug.Log ("healing"); // heal = true; // //Health (1); // } // } // // void OnTriggerExit(Collider other) { // if (other.tag == "ShallowOcean") { // inDeepWater = false; // } // if (other.tag == "DeepOcean") { // inWater = false; // } // } // // IEnumerator HealthLoss () { // while (currenthealth > 0.0f) { // currenthealth += rate * Time.deltaTime; // healthslider.value = currenthealth; // healthcount.text = currenthealth.ToString(); // Debug.Log (currenthealth); // yield return 0; // } // currenthealth = 0; // //return false; // } // // IEnumerator HealthGain () { // while (currenthealth < maxhealth) { // currenthealth += rate * Time.deltaTime; // healthslider.value = currenthealth; // healthcount.text = currenthealth.ToString(); // Debug.Log (currenthealth); // yield return 0; // } // currenthealth = maxhealth; // } // // // public void Dead() { // Debug.Log ("dead"); // dead = true; // deadScreen.SetActive (true); // Player.GetComponent<CharacterMotorC> ().enabled = false; // } void OnClickResourceEvent(ClickResourceEvent e) { if (e.resource is GrassBehavior) { if (accessFuel.GetComponent<Fuel>().currentfuel >= 2) { // grassRemaining -= 1; // Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + grassRemaining + " grass remaining"); // if (grassRemaining == grassStart/2 && palmsAppear == false) { // Debug.Log ("palms appearing"); // iTween.MoveBy(palms,iTween.Hash( // "y" , .5, // "time", 1f // )); // palmsAppear = true; // Debug.Log (palmsAppear); // } // if (grassRemaining == grassStart/3 && grassTwoAppear == false) { // Debug.Log ("grass2 appearing"); // iTween.MoveBy(grassTwo,iTween.Hash( // "y" , .15, // "time", 1f // )); // grassRemaining = grassRemaining + grassStart; // grassTwoAppear = true; // Debug.Log (grassTwoAppear); // } // if (grassRemaining == 0 && grassThreeAppear == false) { // Debug.Log ("grass3 appearing"); // iTween.MoveBy(grassThree,iTween.Hash( // "y" , .15, // "time", 1f // )); // grassRemaining = grassRemaining + grassStart; // grassThreeAppear = true; // Debug.Log (grassThreeAppear); // } // if (grassRemaining <= grassStart && palmsTwo == true && mangrovesAppear == false) { // Debug.Log ("mangroves appearing"); // iTween.MoveBy(mangroves,iTween.Hash( // "y" , .3, // "time", 1f // )); // mangroveRemaining = mangroveStart; // mangrovesAppear = true; // Debug.Log (mangrovesAppear); // } } else { Debug.Log ("NO!"); //play reject sound //reject message } } if (e.resource is OilBehavior) { if (accessFuel.GetComponent<Fuel>().currentfuel < accessFuel.GetComponent<Fuel>().maxfuel) { oilRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (2); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + oilRemaining + " oil remaining"); if (accessFuel.GetComponent<Fuel>().currentfuel >= 8 && grassAppear == false) { Debug.Log ("grass appearing"); iTween.MoveBy(grass,iTween.Hash( "y" , .15, "time", .5f )); grassAppear = true; Debug.Log (grassAppear); } } else { Debug.Log ("NO!"); //play reject sound //reject message } } if (e.resource is MangroveBehavior) { if (mangroveRemaining == 0 && accessFuel.GetComponent<Fuel>().currentfuel == 10) { shrimpRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (-10); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + shrimpRemaining + " shrimp remaining"); } else { if (mangroveRemaining >= 1) { mangroveRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (-8); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + mangroveRemaining + " mangrove remaining"); } } } if (e.resource is TrashBehavior) { if (accessFuel.GetComponent<Fuel>().currentfuel < accessFuel.GetComponent<Fuel>().maxfuel) { trashRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (4); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + trashRemaining + " trash remaining"); if (accessFuel.GetComponent<Fuel>().currentfuel >= 8 && grassAppear == false) { Debug.Log ("grass appearing"); iTween.MoveBy(grass,iTween.Hash( "y" , .1, "time", 1f )); grassAppear = true; Debug.Log (grassAppear); } } else { Debug.Log ("NO!"); //play reject sound //reject message } } if (e.resource is BigTrashBehavior) { if (accessFuel.GetComponent<Fuel>().currentfuel <= 4) { bigTrashRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (6); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + bigTrashRemaining + " bigTrash remaining"); } else { Debug.Log ("NO!"); //play reject sound //reject message } } if (e.resource is PalmBehavior) { if (accessFuel.GetComponent<Fuel>().currentfuel >= 4) { palmRemaining -= 1; accessFuel.GetComponent<Fuel>().Fueling (-4); Debug.Log (accessFuel.GetComponent<Fuel>().currentfuel + " fuel and " + palmRemaining + " palms remaining"); if (palmRemaining == palmStart/2 && palmsTwoAppear == false) { Debug.Log ("palms2 appearing"); iTween.MoveBy(palmsTwo,iTween.Hash( "y" , .2, "time", 1f )); palmRemaining = palmRemaining + 5; palmsTwoAppear = true; Debug.Log (palmsTwoAppear); } if (palmRemaining == palmStart/2 && palmsThreeAppear == false) { Debug.Log ("palms3 appearing"); iTween.MoveBy(palmsThree,iTween.Hash( "y" , .3, "time", 1f )); palmRemaining = palmRemaining + 4; palmsThreeAppear = true; Debug.Log (palmsThreeAppear); } if (grassRemaining <= grassStart && palmsTwoAppear == true && mangrovesAppear == false) { Debug.Log ("mangroves appearing"); iTween.MoveBy(mangroves,iTween.Hash( "y" , .3, "time", 1f )); mangroveRemaining = mangroveRemaining + 4; mangrovesAppear = true; Debug.Log (mangrovesAppear); } } else { Debug.Log ("NO!"); //play reject sound //reject message } } }