// Update is called once per frame void Update() { GameObject cloud = GameObject.Find("Cloud"); WaterInteraction cloudscript = cloud.GetComponent <WaterInteraction>(); int curWater = cloudscript.waterCounter; if (Input.GetKeyDown(KeyCode.F) && curWater > 0) { thunder.Play(); } }
// Update is called once per frame void Update() { GameObject tiles = GameObject.Find("TileHolder"); FireSpawn firescript = tiles.GetComponent <FireSpawn>(); var lenOfFire = firescript.fireArr.Count; var score = firescript.score; firetext.text = "Fires Burning: " + lenOfFire; GameObject[] waterArray = GameObject.FindGameObjectsWithTag("WaterTile"); var lenOfWater = waterArray.Length; watertext.text = "Water Available: " + lenOfWater; scoretext.text = "Score: " + score; scoretext.color = Color.white; GameObject cloud = GameObject.Find("Cloud"); if (cloud == null) { waterammotext.text = "Current Water:"; } else { WaterInteraction cloudscript = cloud.GetComponent <WaterInteraction>(); waterammotext.text = "Current Water: " + cloudscript.waterCounter; Actions cloudactionscript = cloud.GetComponent <Actions>(); actiontext.text = "Actions Remaining: " + cloudactionscript.currNumberofActions; if (lenOfFire >= 0 && lenOfFire <= 4) { firetext.color = Color.green; } else if (lenOfFire > 4 && lenOfFire <= 10) { firetext.color = Color.yellow; } else { firetext.color = Color.red; } if (lenOfWater == 0) { watertext.color = Color.red; } else if (lenOfWater == 1) { watertext.color = Color.yellow; } else { watertext.color = Color.green; } if (cloudscript.waterCounter >= 0 && cloudscript.waterCounter <= 5) { waterammotext.color = Color.red; } else if (cloudscript.waterCounter > 5 && cloudscript.waterCounter <= 10) { waterammotext.color = Color.yellow; } else { waterammotext.color = Color.green; } if (cloudactionscript.currNumberofActions >= 0 && cloudactionscript.currNumberofActions <= 10) { actiontext.color = Color.red; } else if (cloudactionscript.currNumberofActions > 10 && cloudactionscript.currNumberofActions <= 50) { actiontext.color = Color.yellow; } else { actiontext.color = Color.green; } } GameObject plane = GameObject.Find("Plane"); Turns turn = plane.GetComponent <Turns>(); turntext.text = "Turn: " + turn.currTurn; }
/// <summary> /// /// </summary> /// <param name="CP"></param> /// <param name="PP"></param> /// <param name="DOY"></param> /// <param name="latitude"></param> /// <param name="maxT"></param> /// <param name="minT"></param> /// <param name="radn"></param> /// <param name="rpar"></param> /// <returns></returns> public static DCAPSTModel SetUpModel( ICanopyParameters CP, IPathwayParameters PP, int DOY, double latitude, double maxT, double minT, double radn, double rpar) { // Model the solar geometry var SG = new SolarGeometry { Latitude = latitude.ToRadians(), DayOfYear = DOY }; // Model the solar radiation var SR = new SolarRadiation(SG) { Daily = radn, RPAR = rpar }; // Model the environmental temperature var TM = new Temperature(SG) { MaxTemperature = maxT, MinTemperature = minT, AtmosphericPressure = 1.01325 }; // Model the pathways var SunlitAc1 = new AssimilationPathway(CP, PP); var SunlitAc2 = new AssimilationPathway(CP, PP); var SunlitAj = new AssimilationPathway(CP, PP); var ShadedAc1 = new AssimilationPathway(CP, PP); var ShadedAc2 = new AssimilationPathway(CP, PP); var ShadedAj = new AssimilationPathway(CP, PP); // Model the canopy IAssimilation A; if (CP.Type == CanopyType.C3) { A = new AssimilationC3(CP, PP); } else if (CP.Type == CanopyType.C4) { A = new AssimilationC4(CP, PP); } else { A = new AssimilationCCM(CP, PP); } var sunlit = new AssimilationArea(SunlitAc1, SunlitAc2, SunlitAj, A); var shaded = new AssimilationArea(ShadedAc1, ShadedAc2, ShadedAj, A); var CA = new CanopyAttributes(CP, PP, sunlit, shaded); // Model the transpiration var WI = new WaterInteraction(TM); var TR = new TemperatureResponse(CP, PP); var TS = new Transpiration(CP, PP, WI, TR); // Model the photosynthesis var DM = new DCAPSTModel(SG, SR, TM, PP, CA, TS) { B = 0.409 }; return(DM); }
public static void UnregisterInteraction(WaterInteraction interaction) { WaterDynamics.interactions.Remove(interaction); }
public static void RegisterInteraction(WaterInteraction interaction) { WaterDynamics.interactions.Add(interaction); }
// Update is called once per frame void Update() { if (!isLocalPlayer) { return; } var holder = GameObject.FindGameObjectWithTag("Respawn"); var script = holder.GetComponent <FireSpawn> (); int score = script.score; if (score >= winLimit) { SceneManager.LoadScene("ClosingCredits"); } if (actions.currNumberofActions == 4) { origPos = cloud.transform.position; } if (actions.canDoStuff) { Vector3 currentPos = cloud.transform.position; //Debug.Log(currentPos); if (Input.GetKeyDown(KeyCode.W) && (currentPos.x > -40)) { currentPos += new Vector3(-11.2f, 0, 0); actions.currNumberofActions--; //move1.Play (); } if (Input.GetKeyDown(KeyCode.S) && (currentPos.x < 45)) { currentPos += new Vector3(11.2f, 0, 0); actions.currNumberofActions--; //Debug.Log (currentPos); //move1.Play (); } if (Input.GetKeyDown(KeyCode.A) && (currentPos.z > -50)) { currentPos += new Vector3(0, 0, -11.7f); actions.currNumberofActions--; //move2.Play (); } if (Input.GetKeyDown(KeyCode.D) && (currentPos.z < 40)) { currentPos += new Vector3(0, 0, 11.7f); //Debug.Log (currentPos.z); actions.currNumberofActions--; //move2.Play (); } if (Input.GetButtonDown("Fire1")) { GameObject cloud = GameObject.Find("Cloud"); WaterInteraction cloudscript = cloud.GetComponent <WaterInteraction>(); int curWater = cloudscript.waterCounter; if (curWater > 0) { GameObject newRainDrop = GameObject.Instantiate(rainDrop, cloud.transform.position, cloud.transform.rotation) as GameObject; //Debug.Log ("rain"); GameObject lightGameObject = new GameObject("Lightning"); Light lightComp = lightGameObject.AddComponent <Light> (); lightComp.color = Color.yellow; lightComp.intensity = 100; lightComp.range = 20; //thunder.Play(); lightGameObject.transform.position = new Vector3(currentPos.x, currentPos.y - 3, currentPos.z); Destroy(lightGameObject, 0.5f); if (numRainDropsPerAction == rainDropCounter) { actions.currNumberofActions--; } else { ++rainDropCounter; } } } if (currentHeight < 3) { if (Input.GetKeyDown(KeyCode.UpArrow)) { currentPos += new Vector3(0, 11.7f, 0); currentHeight++; actions.currNumberofActions--; } } if (currentHeight > 0) { if (Input.GetKeyDown(KeyCode.DownArrow)) { currentPos += new Vector3(0, -11.7f, 0); currentHeight--; actions.currNumberofActions--; } } if (Input.GetKeyDown(KeyCode.Escape)) { SceneManager.LoadScene("SureQuit"); } if (Input.GetKeyDown(KeyCode.PageUp)) { SceneManager.LoadScene("Title", LoadSceneMode.Single); } if (Input.GetKeyDown(KeyCode.Tab)) { GameObject go = GameObject.FindGameObjectWithTag("song"); AudioSource a = go.GetComponent <AudioSource> (); if (playing == false) { //a.enabled = playing; a.Pause(); } else { a.UnPause(); } playing = !playing; } if (Input.GetKeyDown(KeyCode.C)) { if (controlPanelActive == 0f) { controlPanelActive = 1f; } else { controlPanelActive = 0f; } cPanel.GetComponent <CanvasGroup>().alpha = controlPanelActive; } cloud.transform.position = currentPos; } }