void Start() { //if (!wander) wander = this.GetComponent<WanderScript>(); if (!damageCounterManager) { damageCounterManager = GameObject.FindObjectOfType <DamageCounterManager>(); } if (!healthBarManager) { healthBarManager = GameObject.FindObjectOfType <HealthBarManager>(); } if (!movement) { movement = GetComponent <WalkyWalkyScript>(); } spawnPoint = transform.position; spawnRotation = transform.rotation; if (healthBarManager && !GetComponent <RaidBossController>()) { healthBar = healthBarManager.Add(this); } if (EquipmentStats == null) { EquipmentStats = new EquipmentStats(); } if (Stats == null) { Stats = new Skills(); } }
protected virtual void initialize() { isAlive = true; navMeshAgent = GetComponent <NavMeshAgent>(); healthBarManager = player.GetComponent <HealthBarManager>(); audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>(); }
public void BindHealthBars(HealthBarManager manager) { for (var i = 0; i < _enemies.Count; i++) { _enemies[i].BindHealthBar(manager); } }
// Start is called before the first frame update void Awake() { rb = GetComponent <Rigidbody2D>(); playerHealth = FindObjectOfType <HealthBarManager>(); getLvl = FindObjectOfType <SoalManager>(); }
public GraphicsUI(GraphicsDevice graphicsDevice, GameSession gameSession) : base(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height)) { MainMenu = new MainMenu(graphicsDevice, gameSession); HealthBarManager = new HealthBarManager(graphicsDevice); BackgroundPanel = new BackgroundPanel(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), gameSession); LoginMenu = new LoginMenu(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), gameSession); SettingsMenu = new SettingsMenu(graphicsDevice, gameSession); InventoryMenu = new InventoryMenu(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), gameSession); ActiveGamePanel = new GUIPanel(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height)); ActiveGamePanel.AddElement(HealthBarManager); AddElement(ActiveGamePanel); AddElement(BackgroundPanel); AddElement(MainMenu); AddElement(InventoryMenu); AddElement(LoginMenu); AddElement(SettingsMenu); //Disable all foreach (GUIElement e in ContainedElements) { InitElement(e); } BackgroundPanel.Visible = true; BackgroundPanel.Enabled = true; //Constant menus MessageManager = new MessageManager(new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), gameSession); AddElement(MessageManager); //Set initial menu SetCurrentMenu(LoginMenu); }
protected virtual void Start() { player = GameObject.FindGameObjectWithTag("green"); try { target = player.GetComponent <Player>(); } catch (NullReferenceException) { Debug.Log("Player não encontrado!"); } try { sceneManagerObject = GameObject.FindGameObjectWithTag("SceneManager"); enemyManager = sceneManagerObject.GetComponent <enemyManager>(); healthBarManager = sceneManagerObject.GetComponent <HealthBarManager>(); enemyObject = GameObject.FindGameObjectWithTag("Enemy"); animatorEnemy = enemyObject.GetComponentInChildren <Animator>(); } catch (NullReferenceException) { Debug.Log("erros"); } health = startingHealth; auxHealth = health; //spawnControlAux = spawnControl.GetComponent<Spawner> ().enemiesRemainingAlive; }
internal void BindHealthBar(HealthBarManager manager) { var healthBar = manager.GetHealthBarForTarget(transform); _hp.OnChange += healthBar.ChangeHealth; _hp.OnNoHP += () => manager.RemoveHealthBar(transform); _hp.OnNoHP += SelfDestroy; }
// Start is called before the first frame update void Start() { //Initialize our objects health = GetComponent <Health>(); hbm = healthBar.GetComponent <HealthBarManager>(); thbm = tempHealthBar.GetComponent <HealthBarManager>(); text = HPtext.GetComponent <Text>(); }
protected virtual void Awake() { HealthBarManager hbm = FindObjectOfType <HealthBarManager>(); if (hbm) { hbm.CreateHealthBar(this); } }
void Awake() { if (_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } }
public override void Start() { if (healthBar == null) { healthBar = ObjectManager.Instance.healthBar; } base.Start(); RefreshHealthbar(); }
private void Awake() { if (instance == null) { instance = this; } else { Debug.Log("We messed up bigtime!!"); Destroy(this); } }
void Start() { playerBody = GetComponent <Rigidbody2D> (); playerCollider = GetComponent <CircleCollider2D> (); startingPos = gameObject.transform.position; lastCheckpoint = gameObject.transform.position; health = GetComponent <HealthBarManager> (); isFacingRight = true; isGrounded = true; movementEnabled = true; //Taylor: Checks at start to see if game is loading. If so, sets variables. IsLoadingGame(); }
/// <summary> /// Awake this instance and find the UI texts. /// </summary> void Awake() { //Singleton pattern if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } scoreText = GameObject.Find("ScoreText").GetComponent <Text> (); hb = GameObject.FindWithTag("HealthBar").GetComponent <HealthBarManager> (); ui = GameObject.Find("Canvas").GetComponent <UIController> (); }
public void Initialize() { stats = FindObjectOfType <UIStats>(); feed = FindObjectOfType <BattleFeed>(); turnPointer = FindObjectOfType <TurnPointer>(); healthBar = GetComponent <HealthBarManager>(); CommonUI = GameObject.FindGameObjectWithTag("CommonUI"); BattleUI = GameObject.FindGameObjectWithTag("BattleUI"); // feed.Initialize(); // stats.Initialize(); // turnPointer.Initialize(); //healthBar.Initialize(); BattleUI.SetActive(false); status = ManagerStatus.Online; Debug.Log("UI manager onine"); }
void Start() { //Taylor: Fades screen in. GameObject.Find("GameManager").GetComponent <FadeScript> ().LoadingLevel(); playerBody = GetComponent <Rigidbody2D> (); playerCollider = GetComponent <CircleCollider2D> (); startingPos = gameObject.transform.position; lastCheckpoint = gameObject.transform.position; health = GetComponent <HealthBarManager> (); isFacingRight = true; isGrounded = true; movementEnabled = true; //Taylor: Checks at start to see if game is loading. If so, sets variables. checkpointArray = GameObject.FindGameObjectsWithTag("Checkpoint"); IsLoadingGame(); }
// Use this for initialization void Start() { if (instance != null) { Destroy(instance.gameObject); } instance = this; floatingTextManager = GetComponent <FloatingTextManager>(); healthBarManager = GetComponent <HealthBarManager>(); playerGUI = GetComponent <PlayerGUI>(); itemPopup = itemPopupObject.GetComponent <ItemPopup>(); loadScreen = GetComponent <LoadScreen>(); deathScreen = GetComponent <DeathScreen>(); bossGUI = GetComponent <BossGUI>(); }
private void SetDeath(bool isDead) { if (isDead) { SoundManager.instance.playSoundEffect(2); if (lastCheckpoint != startingPos) { HealthBarManager healthBarManager = GetComponent <HealthBarManager> (); healthBarManager.SendMessage("Reset"); playerBody.transform.position = lastCheckpoint; } else { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); playerBody.transform.position = startingPos; } } }
void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == playerTag) { HealthBarManager playerHealthBar = collider.gameObject.GetComponent <HealthBarManager>(); playerHealthBar.ReduceHealth(0.5f); // Destroy bullet Destroy(this.gameObject); } else if (collider.gameObject.tag == "helicopter") { //do nothing } else { Destroy(this.gameObject); } }
// Use this for initialization void Start() { cam = Camera.main; distanceZ = Mathf.Abs(cam.transform.position.z + transform.position.z); rb = GetComponent <Rigidbody2D> (); gc = GameObject.FindWithTag("GameController").GetComponent <GameController> (); if (gc == null) { Debug.Log("GameController nicht gefunden!"); } pc = GameObject.FindWithTag("Player").GetComponent <PlayerController> (); if (pc == null) { Debug.Log("PlayerController nicht gefunden!"); } op = GameObject.FindWithTag("OptionsController").GetComponent <OptionsController> (); if (op == null) { Debug.Log("OptionsController nicht gefunden!"); } hb = GameObject.FindWithTag("HealthBar").GetComponent <HealthBarManager> (); if (hb == null) { Debug.Log("HealthBarManager nicht gefunden!"); } leftConstraint = cam.ScreenToWorldPoint(new Vector3(0.0f, 0.0f, distanceZ)).x; rightConstraint = cam.ScreenToWorldPoint(new Vector3(Screen.width, 0.0f, distanceZ)).x; bottomConstraint = cam.ScreenToWorldPoint(new Vector3(0.0f, 0.0f, distanceZ)).y; topConstraint = cam.ScreenToWorldPoint(new Vector3(0.0f, Screen.height, distanceZ)).y; float magnitude = Random.Range(minForce, maxForce); float torque = Random.Range(minTorque, maxForce); float x = Random.Range(-1f, 1f); float y = Random.Range(-1f, 1f); rb.AddForce(magnitude * new Vector2(x, y)); rb.AddTorque(torque); }
void Start() { //if (!wander) wander = this.GetComponent<WanderScript>(); if (!damageCounterManager) { this.damageCounterManager = GameObject.FindObjectOfType <DamageCounterManager>(); } if (!healthBarManager) { this.healthBarManager = GameObject.FindObjectOfType <HealthBarManager>(); } if (!walker) { this.walker = this.GetComponent <WalkyWalkyScript>(); } this.spawnPoint = this.transform.position; this.spawnRotation = this.transform.rotation; if (healthBarManager && !this.GetComponent <RaidBossController>()) { healthBarManager.Add(this); } if (EquipmentStats == null) { EquipmentStats = new EquipmentStats(); } if (Stats == null) { Stats = new Skills(); } this.rbody = GetComponent <Rigidbody>(); this.agent = GetComponent <NavMeshAgent>(); }
void Start() { _health = 100; healthBar = GameObject.Find("Health Bar").GetComponent <HealthBarManager>(); }
// Use this for initialization void Awake() { instance = this; }
public void Start() { Instance = this; }
private void Awake() { healthbar = FindObjectOfType <HealthBarManager>(); }
void Awake() { turret = GameObject.Find("Controller").GetComponent <Transform> (); hb = GameObject.FindWithTag("HealthBar").GetComponent <HealthBarManager> (); shield = GameObject.FindWithTag("shield").GetComponent <Transform> (); }
void Start() { myScore = GameObject.FindObjectOfType <Score>(); mySource = GameObject.FindObjectOfType <AudioSource>(); myHealth = GameObject.FindObjectOfType <HealthBarManager>(); }
void Start() { if (!Equipment) { Equipment = GetComponent <PlayerEquipment>(); } if (!Inventory) { Inventory = GetComponent <Inventory>(); } if (!healthBarManager) { healthBarManager = FindObjectOfType <HealthBarManager>(); } if (!agent) { agent = GetComponent <NavMeshAgent>(); } if (!chunkManager) { chunkManager = FindObjectOfType <ChunkManager>(); } if (!gameManager) { gameManager = FindObjectOfType <GameManager>(); } if (!Equipment) { Equipment = GetComponent <PlayerEquipment>(); } if (!rbody) { rbody = GetComponent <Rigidbody>(); } if (!raidHandler) { raidHandler = GetComponent <RaidHandler>(); } if (!arenaHandler) { arenaHandler = GetComponent <ArenaHandler>(); } if (!duelHandler) { duelHandler = GetComponent <DuelHandler>(); } if (!combatHandler) { combatHandler = GetComponent <CombatHandler>(); } if (!playerAppearance) { playerAppearance = GetComponent <PlayerAppearance>(); } if (!playerAnimations) { playerAnimations = GetComponent <PlayerAnimationController>(); } if (healthBarManager) { healthBarManager.Add(this); } }
void Start() { healthBarManager = GetComponent <HealthBarManager>(); }
private void Awake() { instance = this; }