Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SpawnZ : MonoBehaviour {
- public float time;
- public float hp;
- public GameObject z;
- public Transform spawnpoint1;
- public bool spawn = false;
- private bool destroy = true;
- private GameObject ob;
- public static Object Instantiate(Object original, Vector3 position, Quaternion rotation, Transform parent);
- // Use this for initialization
- void Start () {
- hp = 20f;
- }
- // Update is called once per frame
- void Update () {
- time = GameObject.Find ("Sky Dome").GetComponent<TOD_Sky> ().Cycle.Hour;
- if (time > 12 && spawn == false) {
- //спанить и не забыть про хп
- //GameObject ob = Instantiate (z, spawnpoint1) as GameObject;
- GameObject ob = Instantiate(z, new Vector3(0,1,0), Quaternion.identity, spawnpoint1) as GameObject;
- ob.GetComponent<vp_DamageHandler> ().CurrentHealth = hp;
- spawn = true;
- destroy = false;
- }
- /*if (time > 6 && destroy == false) {
- //удалять и запоминать хп
- hp = ob.GetComponent<vp_DamageHandler> ().CurrentHealth;
- DestroyImmediate (ob, true);
- spawn = false;
- destroy = true;
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement