// Use this for initialization public void Start() { // gets the WeaponEditPanel and FireModePanel var wepPanel = transform.parent.transform.FindChild("WeaponEditPanel"); var panel = wepPanel.transform.FindChild("FireModePanel"); // gets the Toggle components of the fire modes isSingleFire = panel.transform.FindChild("Single").GetComponent <Toggle>(); isBurstFire = panel.transform.FindChild("Burst").GetComponent <Toggle>(); isAutoFire = panel.transform.FindChild("Auto").GetComponent <Toggle>(); // get the ProjectileCountPanel // set projectileCount to the Slider components of the ProjectileCountPanel panel = wepPanel.transform.FindChild("ProjectileCountPanel"); projectileCount = panel.transform.FindChild("Slider").GetComponent <Slider>(); // get the SpreadPanel // set spread to the Slider components of the SpreadPanel panel = wepPanel.transform.FindChild("SpreadPanel"); spread = panel.transform.FindChild("Slider").GetComponent <Slider>(); // get the BurstFireCountPanel // set burstFireCount to the Slider components of the BurstFireCountPanel panel = wepPanel.transform.FindChild("BurstFireCountPanel"); burstFireCount = panel.transform.FindChild("Slider").GetComponent <Slider>(); // get the CooldownSpeedPanel // set cooldown to the Slider components of the CooldownSpeedPanel panel = wepPanel.transform.FindChild("CooldownSpeedPanel"); cooldown = panel.transform.FindChild("Slider").GetComponent <Slider>(); // get the RefireRatePanel // set refireRate to the Slider Components of the RefireRatePanel panel = wepPanel.transform.FindChild("RefireRatePanel"); refireRate = panel.transform.FindChild("Slider").GetComponent <Slider>(); Credits.instance.oldValue = Credits.CalculateWeaponCost(PrimaryWeapon); Credits.instance.oldValue += Credits.CalculateWeaponCost(SecondaryWeapon); }
// Update is called once per frame // ReSharper disable once InconsistentNaming // ReSharper disable once UnusedMember.Local private void Update() { // run the speech system //#if ANDROID_DEVICE if (mSpeechDelay <= 0) { if (!mIsListening) { mListeningStatus.color = Color.green; mListeningStatus.text = "Listening"; mIsListening = true; mSpeechDelay = 15; SpeechToText.Listen(); } else if (!SpeechToText.IsListening()) { string theString = SpeechToText.SpeechResult(); mListeningStatus.text = theString; mListeningStatus.color = Color.red; AutoPilot.ECommandCompletionState state = mAutopilot.ParseCommand(theString); switch (state) { case AutoPilot.ECommandCompletionState.Ok: mListeningStatus.color = Color.green; break; case AutoPilot.ECommandCompletionState.How: if (UnityEngine.Random.Range(1, 20) <= 3) SpeechToText.HowMessage(); mListeningStatus.color = Color.blue; break; case AutoPilot.ECommandCompletionState.What: if (UnityEngine.Random.Range(1, 20) <= 1) SpeechToText.WhatMessage(); mListeningStatus.color = Color.red; break; } mSpeechDelay = 30; mIsListening = false; } } else { --mSpeechDelay; } ////check if the left mouse has been pressed down this frame //if (Input.GetMouseButtonDown(0)) { // //empty RaycastHit object which raycast puts the hit details into // RaycastHit hit = new RaycastHit(); //ray shooting out of the camera from where the mouse is // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // if (Physics.Raycast(ray,out hit,5000f)) // { // GameObject target = hit.collider.gameObject; // if (target == TrackTarget) // { // FollowDistance = (target.transform.position - Camera.main.transform.position).magnitude; // FollowTarget = target; // } // else // TrackTarget = target; // } // else // { // //TrackTarget = null; // //FollowTarget = null; // } //} mSolarBodies["sun"].AdvancePosition(mSpacecraft, TimeBase); mAutopilot.Update(TimeBase); if (!mInitialCameraJumpPerformed) { mAutopilot.HandleOrbitalTransition(mSolarBodies["earth"], true); //mAutopilot.Track = mSolarBodies["earth"]; mInitialCameraJumpPerformed = true; } if (mCredits != null) if (!mCredits.Advance(mCreditsDisplay)) mCredits = null; }
public void RunCredits() { mCredits = new Credits(); }