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 SnowBall_Shot : MonoBehaviour {
- public int CostSnow = 20;
- public Text CostText;
- public GameObject SnowBall;
- public float Timer = 1;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if(CostSnow <= 0){
- CostSnow = 0;
- }
- CostText.text = "<color=red>" + "Снежков : " + "</color>" + CostSnow;
- if(Input.GetMouseButtonDown(0))
- {
- CostSnow -= 1;
- if(CostSnow > 0){
- Transform Snowball_move = Instantiate(SnowBall.transform, gameObject.transform.position, Quaternion.identity);
- Snowball_move.GetComponent<Rigidbody>().AddForce(transform.forward * 1500);
- }else{
- Debug.Log("Нет снежков !");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment