// Use this for initialization void Start() { playerGun = GetComponent <Gun>(); playerAction = GetComponent <PlayerAction>(); playerHealth = GetComponent <HealthValues>(); waveValues = FindObjectOfType <WaveValues>(); scoreValues = FindObjectOfType <ScoreValues>(); }
private void Start() { if (!isServer) { Destroy(this); } scoreValues = FindObjectOfType <ScoreValues>(); }
void OnTriggerExit(Collider col) { ScoreValues scoreValues = col.transform.GetComponentInParent <ScoreValues>(); if (scoreValues != null && scoreValues.removedYet == false) { RandomSpawn(); scoreValues.removedYet = true; } }
public void ExitBasket(ScoreValues obj) { atLeastPartlyInBasket.Remove(obj); Renderer rend = obj.GetComponentInChildren <Renderer>(); if (rend.material.shader != selectionShader) { rend.material.shader = invalidShader; } }
private void Update() { if (scoreValues != null) { // Enable or disable the object sign if they have reached the score needed if (scoreValues.scoreNeeded == scoreValues.actualScore) { ActiveSign(true); } else if (scoreValues.scoreNeeded > scoreValues.actualScore) { ActiveSign(false); } } else { scoreValues = FindObjectOfType <ScoreValues>(); } }
void UpdateScore() { if (scoreValues == null) { scoreValues = FindObjectOfType <ScoreValues>(); } // Apply score text and exceeding score if necessary if (scoreValues.exceedingScore == 0) { uiCommonScoreText.text = scoreValues.actualScore + "/" + scoreValues.scoreNeeded; } else { uiCommonScoreText.text = scoreValues.actualScore + "/" + scoreValues.scoreNeeded + " (+" + scoreValues.exceedingScore + ")"; } float score = (float)scoreValues.actualScore; float score2 = (float)scoreValues.scoreNeeded; uiCommonScoreImage.fillAmount = Mathf.Lerp(uiCommonScoreImage.fillAmount, score / score2, fillSpeed); }
public DateSliders() { InitializeComponent(); Scores = new ScoreValues(this); }
// Use this for initialization void Start() { scoreValues = FindObjectOfType <ScoreValues>(); actionableObject = null; }
private void Start() { scoreValues = FindObjectOfType <ScoreValues>(); collider = GetComponents <Collider>(); }
public void EnteredBasket(ScoreValues obj) { atLeastPartlyInBasket.Add(obj); }
// Update is called once per frame void Update() { //Debug.Log(atLeastPartlyInBasket.Count); Vector3 mousePos = Input.mousePosition; // Debug.Log(mousePos); // activeObject.transform.position = mousePos; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit rhInfo; if (Physics.Raycast(ray, out rhInfo, 5000f, clickMask)) //out causes pass by reference //if not carrying an object { if (activeObject == null) { //pick up the object assuming that you've clicked on one, while holding the mouse down if (rhInfo.collider.gameObject.CompareTag("PicnicObject")) { GameObject mouseOverObject = rhInfo.collider.gameObject; Renderer rend = mouseOverObject.GetComponent <Renderer>(); if (Input.GetButtonDown("Fire1")) { if (mySound.isPlaying == false) { mySound.clip = lift; mySound.Play(); } hasBeenRotated = false; activeObject = mouseOverObject; rend.material.shader = selectionShader; activeObject.layer = LayerMask.NameToLayer("Ignore Raycast"); activeObject.GetComponentInParent <Rigidbody>().useGravity = false; activeObject.GetComponentInParent <Rigidbody>().isKinematic = true; activeObject.GetComponent <Collider>().isTrigger = true; activeObject.GetComponentInParent <Rigidbody>().velocity = Vector3.zero; activeObject.GetComponentInParent <Rigidbody>().angularVelocity = Vector3.zero; } ScoreValues svScript = mouseOverObject.GetComponentInParent <ScoreValues>(); nutrDisplayItem.text = "Nutrition: " + svScript.nutrition; flavDisplayItem.text = "Flavor: " + svScript.flavor; alcoDisplayItem.text = "Maturity: " + svScript.alcohol; String nameNoClone = svScript.name; nameNoClone = nameNoClone.Replace("(Clone)", ""); nameNoClone = nameNoClone.Trim(); svScript.name = nameNoClone; heldItemName.text = nameNoClone; heldItemFacts.text = svScript.funFacts; heldItemCost.text = "$" + svScript.itemCost + ".00"; heldItemWeight.text = svScript.itemWeight + "g"; itemInfo.SetActive(true); } else { itemInfo.SetActive(false); } } //if carrying an object else { //it follows the mouse pointer Vector3 carryPoint = rhInfo.point; carryPoint += Vector3.up * 1.5f; activeObject.transform.position = carryPoint; if (Input.GetKeyDown(KeyCode.A)) { cleanUpRotationIfFirst(); activeObject.transform.Rotate(90, 0, 0); } if (Input.GetKeyDown(KeyCode.S)) { cleanUpRotationIfFirst(); activeObject.transform.Rotate(0, 90, 0); } if (Input.GetKeyDown(KeyCode.D)) { cleanUpRotationIfFirst(); activeObject.transform.Rotate(0, 0, 90); } //until you release the mouse button if (Input.GetButtonUp("Fire1")) { if (mySound.isPlaying == false && UnityEngine.Random.Range(0, 100) < 19) { mySound.clip = voices[voiceNum]; mySound.Play(); voiceNum++; voiceNum = voiceNum % voices.Length; } if (mySound.isPlaying == false) { mySound.clip = release; mySound.Play(); } Renderer rend = activeObject.GetComponent <Renderer>(); rend.material.shader = invalidShader; //diffuseShader; activeObject.layer = LayerMask.NameToLayer("Default"); activeObject.GetComponentInParent <Rigidbody>().useGravity = true; activeObject.GetComponentInParent <Rigidbody>().isKinematic = false; activeObject.GetComponent <Collider>().isTrigger = false; activeObject = null; nutrDisplayItem.text = "Nutrition: ?"; flavDisplayItem.text = "Flavor: ?"; alcoDisplayItem.text = "Alcohol: ?"; heldItemName.text = "Item Name"; heldItemFacts.text = "Prepare yourself for amazing facts"; heldItemCost.text = "Cost"; heldItemWeight.text = "Weight"; itemInfo.SetActive(false); } //fire1 } //else } //raycast } //update()