Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CreaPelotas : MonoBehaviour {
  5.     public GameObject pelota;
  6.     // Use this for initialization
  7.     void Start () {
  8.  
  9.     }
  10.    
  11.     // Update is called once per frame
  12.     void Update () {
  13.         if (GameObject.Find ("PelotaNueva") == null) {
  14.             if (Input.GetKeyDown (KeyCode.Space)) {
  15.                 GameObject pelotaNueva = (GameObject)Instantiate (pelota);
  16.                 pelotaNueva.name = "PelotaNueva";
  17.                 pelotaNueva.transform.position = new Vector3 (pelota.transform.position.x, pelota.transform.position.y + 5, pelota.transform.position.z);
  18.             }
  19.         }
  20.         if (Input.GetKeyDown(KeyCode.B)){
  21.             if(GameObject.Find("PelotaNueva") != null){
  22.                 Destroy(GameObject.Find ("PelotaNueva"));
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement