void Awake() { if (spawnManager.instance == null) { spawnManager.instance = this; } }
void Split() { //find scene manager and get the spawnManager from it spawnManager mana = GameObject.Find("Scene Manager").GetComponent <spawnManager>(); //Check if the asteroid has been broken before if (isBig) { //if not create two new small asteroids and add them to the asteroids List for (int i = 1; i < 3; i++) { mana.asteroids.Remove(gameObject); mana.SpawnAsteroidSmall(); GameObject tempAster = mana.asteroids[mana.asteroids.Count - 1]; tempAster.GetComponent <asteroidSplit>().isBig = false; tempAster.transform.position = gameObject.transform.position; mana.asteroids[mana.asteroids.Count - 1] = tempAster; } //Destroy this object Destroy(gameObject); //if the asteroid has been broken before then remove this object from the List and destory it } else { mana.asteroids.Remove(gameObject); Destroy(gameObject); } }
public GameObject Enemy; //Prefab을 받을 public 변수 입니다. void Awake() { if (!instance) //정적으로 자신을 체크합니다. { instance = this; //정적으로 자신을 저장합니다. } }
// Use this for initialization void Start() { curHealth = maxHealth; curAmmo = maxAmmo; playerMovement = gameObject.GetComponentInParent <player_Movement>(); spawner = GameObject.Find("_GameManager").GetComponent <spawnManager>(); }
void Start() { transform.position = new Vector3(0, 0, 0); _health = _max_health; _shieldObj = transform.Find("Shields").gameObject; _shieldObj.SetActive(false); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent<spawnManager>(); _uiManager = GameObject.Find("Canvas").GetComponent<UIManager>(); _audioSource = GetComponent<AudioSource>(); _thrustspeed = _speed * 2; _ammo = _ammoMax; _uiManager.SetAmmo(_ammo, _ammoMax); if (_spawnManager == null) { Debug.LogError("Spawn Manager is null"); } if (_uiManager == null) { Debug.LogError("UI Manager is null"); } if (_audioSource == null) { Debug.LogError("Audio Source is null"); } else { _audioSource.clip = _LaserFireClip; } }
void Start() { spawner = FindObjectOfType <spawnManager>(); startTime = spawner.timeLeft; cactusController = FindObjectOfType <CactusController>(); lastRotateValue = cactusController.getRVValue(energyChargeControl); Reset(); }
void Start() { gameObject.GetComponent <SpriteRenderer>().sprite = normal; sT = FindObjectOfType <stats>(); sM = FindObjectOfType <spawnManager>(); sM2 = FindObjectOfType <spawnManager2>(); hasDied = false; }
// Start is called before the first frame update void Start() { pointToGo = GameObject.Find("BossSpawnPoint").transform; _healthObject = GameObject.Find("Canvas").transform.Find("BossHealthBar").gameObject; _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <spawnManager>(); _curRound = _spawnManager.CurRound(); _maxHealth *= _curRound; _curHealth = _maxHealth; _healthObject.GetComponent <Image>().fillAmount = _curHealth / _maxHealth; }
// Start is called before the first frame update void Start() { transform.position = new Vector3(0, 0, 0); _spawn = GameObject.Find("spawnManager").GetComponent <spawnManager>(); uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); playerAudioSource = GetComponent <AudioSource>(); if (_spawn == null) { Debug.Log("spawn is null"); } }
// Use this for initialization void Start() { _UIManager = GameObject.Find("Canvas").GetComponent <UIManager>(); _spawnManager = GameObject.Find("spawnManager").GetComponent <spawnManager>(); anim = GetComponent <Animator>(); rightCollider = _attackColliderRight.GetComponent <Collider2D>(); leftCollider = _attackColliderLeft.GetComponent <Collider2D>(); upCollider = _attackColliderUp.GetComponent <Collider2D>(); downCollider = _attackColliderDown.GetComponent <Collider2D>(); _speed = 10f; _lives = 5; //cambiar después _UIManager.UpdateLives(_lives); }
// Start is called before the first frame update void Start() { _player = GameObject.Find("Player").GetComponent <Player>(); _Animator = gameObject.GetComponent <Animator>(); _collider2D = GetComponent <Collider2D>(); _audioSource = GetComponent <AudioSource>(); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <spawnManager>(); _centerLine = transform.position.x; _shieldObj = transform.Find("Shields").gameObject; _shieldObj.SetActive(false); float _shieldRandom = UnityEngine.Random.Range(0f, 100.0f); if (_shieldChancePercent >= _shieldRandom) { _shieldObj.SetActive(true); _shields = 1; } float _smartRandom = UnityEngine.Random.Range(0f, 100.0f); if (_smartEnemyPercent >= _smartRandom) { _smartEnemy = true; } if (_player == null) { Debug.LogError("Player is NULL"); } if (_Animator == null) { Debug.LogError("Animator is NULL"); } if (_spawnManager == null) { Debug.LogError("Spawn_Manager is NULL"); } if (_collider2D == null) { Debug.LogError("Collider2D is NULL"); } if (_audioSource == null) { Debug.LogError("AudioSource is NULL"); } _curWave = _spawnManager.CurWave() * _spawnManager.CurRound(); StartCoroutine(ShootEnemyLaser()); }
// Use this for initialization void Start() { spawnmanager = GameObject.FindObjectOfType <spawnManager> (); //randNr = Random.Range (1, 2); //if (randNr == 1) { // waypointList [randNr] = GameObject.Find ("spawnpoint1").transform.position; //if (randNr == 2) { // waypointList [randNr] = GameObject.Find ("spawnpoint2").transform.position; int numSpawnpoints = 4; waypointList = spawnmanager.genWay; for (int i = 1; i < 4; i++) { GameObject g = null; Transform t = null; while (g == null) { g = spawnmanager.AllSpawnPoints[i, Random.Range(0, numSpawnpoints - 1)]; if (g != null) { t = g.transform; } } waypointList[i] = t; } targetWayPoint = waypointList [1]; transform.LookAt(targetWayPoint); scoreManager = GameObject.FindObjectOfType <ScoreManager>(); initialized = true; }
// Use this for initialization void Start() { _spawnManager = GameObject.Find("spawnManager").GetComponent <spawnManager>(); scoreText.text = "0"; _gameInProgress = false; }
// Use this for initialization void Start() { scene = manager.GetComponent <spawnManager>(); }
// Start is called before the first frame update void Start() { uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>(); sManager = GameObject.Find("Spawn_manager").GetComponent <spawnManager>(); }
// Use this for initialization void Start() { spawner = GameObject.Find("_GameManager").GetComponent <spawnManager>(); }