Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class SpawnZ : MonoBehaviour {
  6.  
  7.     public float time;
  8.     public float hp;
  9.     public GameObject z;
  10.     public Transform spawnpoint1;
  11.     public bool spawn = false;
  12.     private bool destroy = true;
  13.     private GameObject ob;
  14.     public static Object Instantiate(Object original, Vector3 position, Quaternion rotation, Transform parent);
  15.     // Use this for initialization
  16.     void Start () {
  17.         hp = 20f;
  18.     }
  19.    
  20.     // Update is called once per frame
  21.     void Update () {
  22.         time = GameObject.Find ("Sky Dome").GetComponent<TOD_Sky> ().Cycle.Hour;
  23.  
  24.         if (time > 12 && spawn == false) {
  25.             //спанить и не забыть про хп
  26.             //GameObject ob = Instantiate (z, spawnpoint1) as GameObject;
  27.             GameObject ob = Instantiate(z, new Vector3(0,1,0), Quaternion.identity, spawnpoint1) as GameObject;
  28.  
  29.             ob.GetComponent<vp_DamageHandler> ().CurrentHealth = hp;
  30.             spawn = true;
  31.             destroy = false;
  32.  
  33.         }
  34.         /*if (time > 6 && destroy == false) {
  35.             //удалять и запоминать хп
  36.             hp = ob.GetComponent<vp_DamageHandler> ().CurrentHealth;
  37.             DestroyImmediate (ob, true);
  38.             spawn = false;
  39.             destroy = true;
  40.         }*/
  41.     }
  42.            
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement