void Start() { cam = Camera.main; actionBar = FindObjectOfType <ActionBar>(); campfire = FindObjectOfType <Campfire>(); envDetails = FindObjectOfType <EnvDetails>(); fireSound = GetComponentInParent <AudioSource>(); //Cursor.lockState = CursorLockMode.Locked; }
void FixedUpdate() { if (Vector3.Distance(campFire.position, this.transform.position) < radius) { envDetails = FindObjectOfType <EnvDetails>(); if (isLocalPlayer) { envDetails.celsiusTemp += 0.01f; } } }
void Update() { switchSound.pitch = Random.Range(1f, 1.25f); if (Input.GetKeyDown(KeyCode.Alpha1)) { toggleSpear(); hatchet.SetActive(false); rifle.SetActive(false); launcher.SetActive(false); } if (Input.GetKeyDown(KeyCode.Alpha2)) { toggleHatchet(); spear.SetActive(false); rifle.SetActive(false); launcher.SetActive(false); } if (Input.GetKeyDown(KeyCode.Alpha3)) { toggleRifle(); spear.SetActive(false); hatchet.SetActive(false); launcher.SetActive(false); } if (Input.GetKeyDown(KeyCode.Alpha4)) { toogleLauncher(); spear.SetActive(false); hatchet.SetActive(false); rifle.SetActive(false); } //rocketlauncher thingy //Button heal = healButton.GetComponent<Button>(); envDetails = FindObjectOfType <EnvDetails>(); //heal.onClick.AddListener(healSelf); //if (Input.GetKey(healNumber)) { // healSelf(); //} }
void Update() { if (Input.GetKey(KeyCode.Escape)) { //Application.Quit(); } localTime.text = System.DateTime.Now.ToString("hh:mm tt"); //LOCAL TIME movement = FindObjectOfType <Movement>(); envDetails = FindObjectOfType <EnvDetails>(); camMovment = FindObjectOfType <CameraMovement>(); actionBar = FindObjectOfType <ActionBar>(); campfire = FindObjectOfType <Campfire>(); jetFly = FindObjectOfType <JetFly>(); jetCam = FindObjectOfType <jetCam>(); UpdateHealthBar(); UpdateStaminaBar(); UpdateThrustBar(); staminaText.text = envDetails.stamina.ToString("0"); healthText.text = envDetails.health.ToString("0"); temperatureText.text = envDetails.celsiusTemp.ToString("0" + "°C"); amountBandage.text = actionBar.maxHealCount.ToString("0"); amountAdrenalin.text = actionBar.maxEnergyCount.ToString("0"); amountWood.text = actionBar.Wood.ToString("0"); ownWoodinCampfire.text = actionBar.Wood.ToString("0"); rawLamb.text = actionBar.rawLamb.ToString("0"); campfireWoodAmount.text = campfire.campfireInventoryWood.ToString("0"); // Wood-Inventory of campfire heading.text = jetCam.forwardRot.ToString("0" + "°"); altitude.text = jetFly.hit.transform.position.y.ToString("0"); velocity.text = jetFly.hit.rigidbody.velocity.z.ToString("0"); //if (camMovment.hit.collider.name != "Ground") //{ // focusedText.text = camMovment.hit.collider.name.ToString(); //} }
void FixedUpdate() { if (detected == true) { this.transform.position = Vector3.MoveTowards(this.transform.position, this.player.position, speed * Time.deltaTime); if (Vector3.Distance(this.transform.position, this.player.position) < attackDistance) { envDetails.health -= 0.5f; } } if (Vector3.Distance(enemy.position, this.player.position) < viewDistance) { envDetails = FindObjectOfType <EnvDetails>(); detected = true; } }
public void FillData() { //engine setting uint width, height; Engine.Instance.Driver.GetDisplayMode(out width, out height); SVideoSetting videoSetting = Engine.Instance.VideoSetting; // DisplayModes.Clear(); DisplayModes.Add(new DisplayMode() { WindowMode = true }); _cbDisplayModes.SelectedIndex = 0; _cbDisplayModes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // Resolutions.Clear(); Resolutions.Add(new Resolution() { Width = width, Height = height }); _cbResolutions.SelectedIndex = 0; _cbResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // RefreshRates.Default(); _cbRefreshRates.SelectedIndex = 0; _cbRefreshRates.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // VideoDevices.Clear(); VideoDevices.Add(new VideoDevice() { Index = 0 }); _cbVideoDevices.SelectedIndex = 0; _cbVideoDevices.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // MultiSamples.Default(); _cbMultisamples.SelectedItem = (from x in MultiSamples where x.Sample == videoSetting.antialias select x).ToArray()[0]; _cbMultisamples.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // _cbVsyncs.SelectedItem = (from x in VSyncs where x.On == videoSetting.vsync select x).ToArray()[0]; _cbVsyncs.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // MatResolutions.Clear(); MatResolutions.Add(new OptionLevel() { Level = E_LEVEL.EL_LOW }); MatResolutions.Add(new OptionLevel() { Level = E_LEVEL.EL_FAIR }); MatResolutions.Add(new OptionLevel() { Level = E_LEVEL.EL_GOOD }); MatResolutions.Add(new OptionLevel() { Level = E_LEVEL.EL_HIGH }); _cbMatResolutions.SelectedItem = (from x in MatResolutions where x.Level == videoSetting.textureResolution select x).ToArray()[0]; _cbMatResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // _cbMatTextureFilters.SelectedItem = (from x in MatTextureFilters where x.Filter == videoSetting.textureFiltering select x).ToArray()[0]; _cbMatTextureFilters.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // _cbMatProjections.SelectedItem = (from x in MatProjections where x.On == false select x).ToArray()[0]; _cbMatProjections.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); // ViewDistances.Default(); _cbViewDistances.SelectedItem = (from x in ViewDistances where x.Level == videoSetting.viewDistance select x).ToArray()[0]; _cbViewDistances.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); EnvDetails.Default(); _cbEnvDetails.SelectedItem = (from x in EnvDetails where x.Level == videoSetting.envDetail select x).ToArray()[0]; _cbEnvDetails.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); GroundScenes.Default(); _cbGroundScenes.SelectedItem = (from x in GroundScenes where x.Level == videoSetting.groundClutter select x).ToArray()[0]; _cbGroundScenes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); ShadowQualities.Default(); _cbShadowQuality.SelectedItem = (from x in ShadowQualities where x.Level == videoSetting.shadowQuality select x).ToArray()[0]; _cbShadowQuality.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); LiquidDetails.Clear(); LiquidDetails.Add(new OptionLevel() { Level = E_LEVEL.EL_LOW }); LiquidDetails.Add(new OptionLevel() { Level = E_LEVEL.EL_FAIR }); LiquidDetails.Add(new OptionLevel() { Level = E_LEVEL.EL_GOOD }); LiquidDetails.Add(new OptionLevel() { Level = E_LEVEL.EL_ULTRA }); _cbLiquidDetail.SelectedItem = (from x in LiquidDetails where x.Level == videoSetting.liquidDetail select x).ToArray()[0]; _cbLiquidDetail.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); SunLightEffects.Clear(); SunLightEffects.Add(new OptionLevel() { Level = E_LEVEL.EL_DISABLE }); SunLightEffects.Add(new OptionLevel() { Level = E_LEVEL.EL_LOW }); SunLightEffects.Add(new OptionLevel() { Level = E_LEVEL.EL_HIGH }); _cbSunLightEffect.SelectedItem = (from x in SunLightEffects where x.Level == videoSetting.sunshafts select x).ToArray()[0]; _cbSunLightEffect.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); ParticleDensities.Default(); _cbParticleDensity.SelectedItem = (from x in ParticleDensities where x.Level == videoSetting.particleDensity select x).ToArray()[0]; _cbParticleDensity.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); SSAOLevels.Clear(); SSAOLevels.Add(new OptionLevel() { Level = E_LEVEL.EL_DISABLE }); SSAOLevels.Add(new OptionLevel() { Level = E_LEVEL.EL_LOW }); SSAOLevels.Add(new OptionLevel() { Level = E_LEVEL.EL_HIGH }); _cbSSAO.SelectedItem = (from x in SSAOLevels where x.Level == videoSetting.SSAO select x).ToArray()[0]; _cbSSAO.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged); }
// Update is called once per frame void Update() { envDetails = FindObjectOfType <EnvDetails>(); }