void Start() { if (ManagerContainer != null) manager = ManagerContainer.GetComponent<LevelManagerScript>(); if (manager == null) { GetManager(); } }
void Start() { isBreakable = (this.tag == "Breakable"); if (isBreakable) { breakableCount++; } timesHit = 0; levelManager = GameObject.FindObjectOfType <LevelManagerScript>(); }
private void Awake() { levelManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <LevelManagerScript>(); uIManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <UIManagerScript>(); mySpriteRenderer = GetComponent <SpriteRenderer>(); canvas = GetComponentInChildren <Canvas>().gameObject; isEmpty = true; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Enemy") { GameObject LevelManager = (GameObject)GameObject.Find("LevelManager"); LevelManagerScript levelManagerScript = LevelManager.GetComponent <LevelManagerScript>(); levelManagerScript.LoadLose(); } Destroy(collision.gameObject); }
protected virtual void Awake() { myCollider2D = GetComponent <Collider2D>(); myRigidBody2D = GetComponent <Rigidbody2D>(); mySpriteRenderer = GetComponent <SpriteRenderer>(); myAnimator = GetComponent <Animator>(); LevelManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <LevelManagerScript>(); waveManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <WaveManagerScript>(); }
// Use this for initialization void Start() { if (this.tag == "Breakable") { breakableCount++; print("breakable " + breakableCount); } maxHit = hitSprites.Length + 1; levelManager = GameObject.FindObjectOfType <LevelManagerScript> (); timesHit = 0; }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
// Use this for initialization void Start() { cm = FindObjectOfType <CrystalManager>(); cw1 = FindObjectOfType <CrystalWhite1>(); cw2 = FindObjectOfType <CrystalWhite2>(); cw3 = FindObjectOfType <CrystalWhite3>(); lms = FindObjectOfType <LevelManagerScript>(); timer = 3f; endImg.color = endImgColor; endImg.enabled = false; }
private void Awake() { trapManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <TrapManagerScript>(); levelManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <LevelManagerScript>(); uIManager = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <UIManagerScript>(); ballistaScript = GameObject.FindGameObjectWithTag("Player").GetComponent <BallistaScript>(); price = trapManager.GetPrice(trapType); priceText.text = price.ToString(); }
// Hämtar hem levelManagern samt kollar igenom antal brickor på spelfältet void Start() { isBreakable = (this.tag == "Breakable"); if (isBreakable) { breakableCount++; } amountHits = 0; levelManager = FindObjectOfType <LevelManagerScript>(); }
// Use this for initialization void Start() { ps = GetComponent <ParticleSystem>(); isBreakable = (this.tag == "Breakable"); // Keep track of breakable bricks if (isBreakable) { brickCount++; } timesHit = 0; levelManager = GameObject.FindObjectOfType <LevelManagerScript>(); }
void Awake() { if (!instance) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
private void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Awake() { instance = this; PlayersBallMechanism = FindObjectsOfType <CubeMechanism>(); //mainCameraMovement = Camera.main.GetComponent<CameraMovement>(); StartCoroutine(PlayerTracking()); ObjectToPause = new IPauseRestart[gameObjectsContainingIPauseRestart.Length]; for (int i = 0; i < gameObjectsContainingIPauseRestart.Length; i++) { ObjectToPause[i] = gameObjectsContainingIPauseRestart[i].GetComponent <IPauseRestart>(); } }
void OnSceneLoad(Scene scene, LoadSceneMode mode) { GameObject LevelManager = (GameObject)GameObject.Find("LevelManager"); levelManagerScript = LevelManager.GetComponent <LevelManagerScript>(); if (hideMouse) { if (scene.name != "Menu" && scene.name != "Win" && scene.name != "Lose") { Cursor.visible = false; } else { Cursor.visible = true; } } GameObject[] scoreTexts = GameObject.FindGameObjectsWithTag("ScoreTextUI"); if (scoreTexts.Length > 0) { scoreText = scoreTexts[0].GetComponent <Text>(); scoreText.text = "Score " + score.ToString(); } GameObject[] livesTexts = GameObject.FindGameObjectsWithTag("LivesTextUI"); if (livesTexts.Length > 0) { livesText = livesTexts[0].GetComponent <Text>(); UpdateLivesDisplay(); } FinalScoreScript finalScoreScript = GameObject.FindObjectOfType <FinalScoreScript>(); if (finalScoreScript != null) { finalScoreScript.SetScore(score); //Finding final score script also means we need a life reset livesLeft = lives; } if (scene.name == "Lose") { score = 0; } }
private void Start() { myRenderer = this.gameObject.GetComponent <SpriteRenderer>(); myCollider = this.gameObject.GetComponent <BoxCollider2D>(); current = Resources.LoadAll <Sprite>("DoorUp"); anim = this.gameObject.GetComponent <Animation>(); a = 1; if (winNum == 0) { winNum = 6; } else { LevelManager = GameObject.Find("LevelManager"); LScript = LevelManager.GetComponent <LevelManagerScript>(); } }
/// <summary> /// Initialization /// </summary> void Start() { //Find Controls window = this.transform.GetComponent(typeof(BitWindow)) as BitWindow; btnOK = this.transform.FindChild("btnOk").GetComponent <BitButton>(); levelManager = GameObject.FindObjectOfType(typeof(LevelManagerScript)) as LevelManagerScript; lblTitle = this.transform.FindChild("lblTitle").GetComponent <BitLabel>(); lblMessage = this.transform.FindChild("lblMessage").GetComponent <BitLabel>(); //Subscribe to events btnOK.MouseClick += new Bitverse.Unity.Gui.MouseClickEventHandler(btnOK_MouseClick); //Don't show the windows this.window.Enabled = false; this.window.Visible = false; }
void Start() { if (!instance) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); music = GameObject.Find("MusicManager").GetComponent <AudioSource>(); Debug.Log(music.clip.name); music.volume = float.Parse(PlayerPrefs.GetString("MusicVolume")); music.ignoreListenerVolume = true; music.Play(); }
/// <summary> /// Initialization /// </summary> void Start() { //Find Controls window = this.transform.GetComponent(typeof(BitWindow)) as BitWindow; btnOK = this.transform.FindChild("btnOk").GetComponent<BitButton>(); levelManager = GameObject.FindObjectOfType(typeof(LevelManagerScript)) as LevelManagerScript; lblTitle = this.transform.FindChild("lblTitle").GetComponent<BitLabel>(); lblMessage = this.transform.FindChild("lblMessage").GetComponent<BitLabel>(); //Subscribe to events btnOK.MouseClick += new Bitverse.Unity.Gui.MouseClickEventHandler(btnOK_MouseClick); //Don't show the windows this.window.Enabled = false; this.window.Visible = false; }
private bool _settled = false;//胜负已分 void Start() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } _lastTimePigExist = Time.time; _lastTimeBirdExist = Time.time; _lastTimeBlockMove = Time.time; _score = 0; _audioSource = GetComponent <AudioSource>(); _audioSource.PlayOneShot(startSound); }
} //returns the time that the current wave should take to spawn. used for survivors. // Use this for initialization private void Awake() { //shuffle music for (int i = 0; i < levelMusic.Length; i++) { int j = UnityEngine.Random.Range(0, levelMusic.Length); AudioClip temp = levelMusic[i]; levelMusic[i] = levelMusic[j]; levelMusic[j] = temp; } //init vars instance = this; wavesSpawning = 0; wavesInDeck = 0; levelLoaded = false; totalSpawnCount = -1; endurance = false; }
void HandleHits() { timesHit++; int maxHits = hitSprites.Length + 1; if (timesHit >= maxHits) { breakableBrickCount--; PuffSmoke(); Destroy(gameObject); if (breakableBrickCount == 0) { LevelManagerScript.LoadNextLevel(); } } else { LoadSprites(); } }
private void Awake() { GameObject gameController = GameObject.FindGameObjectWithTag("GameController"); levelManager = gameController.GetComponentInChildren <LevelManagerScript>(); uIManager = gameController.GetComponentInChildren <UIManagerScript>(); poolManager = gameController.GetComponentInChildren <PoolManagerScript>(); waves = GetComponentsInChildren <WaveScript>(); spawners = GameObject.FindGameObjectsWithTag("Spawner"); DebugScript(); for (int i = 0; i < enemyList.Length; ++i) { enemyList[i].poolID = poolManager.PreCache(enemyList[i].prefab); } SetupWave(); }
//Use this for initialization void Start() { // initialize data members statArray = new int[] { maxHealth, attack, defense, agility }; statGrowthArray = new float[] { maxHealthGrowth, attackGrowth, defenseGrowth, agilityGrowth }; experienceUpdating = false; tilePrev = null; priority = 0; // if unit is in combat, find the level manager and UI elements if (GameManager.instance.GetComponent <GameManager>().inCombat) { availableTiles = new List <List <int> >(); levelManagerScript = GameObject.Find("LevelManager(Clone)").GetComponent <LevelManagerScript>(); levelUpSheet = levelManagerScript.characterSheet; progressBar = levelManagerScript.progressBar; } selectedFlag = false; finished = false; dead = false; defender = false; moving = false; itemIndex = 0; // instantiate the items held by the unit foreach (GameObject item in itemList) { item.GetComponent <ItemScript>().ItemInstantiate(); item.GetComponent <ItemScript>().holder = gameObject; } statusList = new List <string>(); statusDurationList = new List <int>(); }
private void Awake() { GameObject gameController = GameObject.FindGameObjectWithTag("GameController"); levelManager = gameController.GetComponentInChildren <LevelManagerScript>(); uIManager = gameController.GetComponentInChildren <UIManagerScript>(); poolManager = gameController.GetComponentInChildren <PoolManagerScript>(); waveManager = gameController.GetComponentInChildren <WaveManagerScript>(); mySpriteRenderer = ballistaHead.GetComponent <SpriteRenderer>(); myAnimator = ballistaHead.GetComponent <Animator>(); isAlive = true; currentLife = life; currentAmmo = ammo; boltPoolID = poolManager.PreCache(boltPrefab, 2); canShoot = true; UpdateUI(); }
void Awake() { instance = this; }
// Start is called before the first frame update void Awake() { levelManager = FindObjectOfType <LevelManagerScript>(); }
// Use this for initialization void Start() { TimesHit = 0; LevelManager = GameObject.FindObjectOfType <LevelManagerScript>(); }
// Update is called once per frame void GetManager() { manager = GameObject.Find("LevelManagerContainer").GetComponent<LevelManagerScript>(); }
// Use this for initialization void Start() { manager = GameObject.Find("LevelManagerContainer").GetComponent<LevelManagerScript>(); looker = new GameObject(); looker.transform.parent = transform; NearestPointOnPath = Vector3.zero; if (manager.AllPathWaypoints.Length > 1) { if (NextWaypoint == null && PrevWaypoint == null) { NextWaypoint = FindNearestPathWaypoint(); SetNextWaypoint(); } else if (NextWaypoint == null) { SetNextWaypoint(); } else if (PrevWaypoint == null) { PrevWaypoint = FindNearestPathWaypoint(); } AllWaypointsSet = true; } NextWaypointData = NextWaypoint.GetComponent<PathWaypointScript>(); PrevWaypointData = PrevWaypoint.GetComponent<PathWaypointScript>(); transWaypointVector = NextWaypoint.transform.position - PrevWaypoint.transform.position; }
public void SetLevel(LevelManagerScript lv) { currentLevelScript = lv; }
//instantiate the item, initialize tileList values. public void ItemInstantiate() { levelManagerScript = GameObject.Find("LevelManager(Clone)").GetComponent <LevelManagerScript>(); validTiles = new List <List <int> >(); tilesInRadius = new List <List <int> >(); }
private void Awake() { levelManagerScript = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <LevelManagerScript>(); }
void Start() { levelManager = GameObject.FindObjectOfType <LevelManagerScript>(); }
void Start() { rb = GetComponent<Rigidbody> (); transform = GetComponent<Transform> (); levelManager = GameObject.Find ("LevelManager"); camScript = levelManager.GetComponent<LevelManagerScript> (); pixelScript = GetComponent<Sprite3D> (); sprite = GetComponent<SpriteRenderer> (); }