Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class sas : MonoBehaviour
- {
- // Start is called before the first frame update
- public Material m1;
- public int score_eag;
- public int score_psheno;
- public int score_milk;
- public int ALL_MONEY;
- public GameObject chiken;
- public GameObject cow;
- public GameObject field;
- public Text scoretext1;
- public Text scoretext2;
- public Text scoretext3;
- void Start()
- {
- }
- // Update is called once per frame
- void FixedUpdate()
- {
- Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
- RaycastHit hit;
- if (Physics.Raycast(ray, out hit) && Input.GetMouseButtonDown(0))
- {
- if (hit.collider.tag == "chiken")
- {
- score_eag += 1;
- ALL_MONEY += 15;
- chiken.gameObject.GetComponent<Renderer>().material = m1;
- scoretext1.text = "eag:" + score_eag;
- }
- if (Physics.Raycast(ray, out hit) && Input.GetMouseButtonDown(0))
- if (hit.collider.tag == "cow")
- {
- score_psheno += 1;
- ALL_MONEY += 40;
- chiken.gameObject.GetComponent<Renderer>().material = m1;
- scoretext2.text = "milk:" + score_milk;
- }
- if (Physics.Raycast(ray, out hit) && Input.GetMouseButtonDown(0))
- if (hit.collider.tag == "field")
- {
- score_milk += 1;
- ALL_MONEY += 20;
- scoretext3.text = "field:" + score_psheno;
- chiken.gameObject.GetComponent<Renderer>().material = m1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment