void Start() { playerHealth = this; healthText = GetComponentInChildren <TextMeshProUGUI>(); defaultColor = healthText.color; defaultGradient = healthText.colorGradient; effectColor = defaultColor; effectGradient = defaultGradient; }
// Use this for initialization void Start () { animationScript = GetComponent<PlayerAnimation> (); jumpScript = GetComponent<PlayerJump> (); localSpriteRenderer = GetComponent<SpriteRenderer> (); scoreScript = GetComponent<TheScoreSystem> (); currentHealth = maxHealth; healthUIScript = gameUI.GetComponent<UIHealth> (); }
public void UpdateHealth() { UIHealth Health = DmgBar.GetComponent <UIHealth>(); Health.PercentHealth -= 10; if (Health.PercentHealth <= 0) { //Game Over SceneManager.GetComponent <SceneFunctions>().SwitchtoGGScene(); } }
void Destroyer() { GameObject GO = Instantiate(Explosion, transform.position, Quaternion.identity); UIHealth uh = GetComponent <UIHealth>(); if (uh != null) { uh.healthbar.fillAmount = 0; } Destroy(gameObject); Destroy(GO, 0.08f); }
public void UpdateHealth(int Dmg) { //Updates Player Health Functions UIHealth Health = DmgBar.GetComponent <UIHealth>(); Health.Damage(Dmg); if (Health.PercentHealth <= 0) { //Game Over SceneManager.GetComponent <SceneFunctions>().SwitchtoGGScene(); } }
// Start is called before the first frame update void Start() { health = maxHealth; if (gameObject.tag == "Player") { healthIndicator = GameObject.Find("UIHealth").GetComponent <UIHealth>(); } if (healthIndicator) { healthIndicator.setHealth(health); } }
void Start() { ragdoll = GetComponent <RagdollScript>(); currentHealth = maxHealth; skinnedMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>(); healthbar = GetComponentInChildren <UIHealth>(); var rigidBodies = GetComponentsInChildren <Rigidbody>(); foreach (var rigidbody in rigidBodies) { HitBox hitBox = rigidbody.gameObject.AddComponent <HitBox>(); hitBox.health = this; } }
public void Init(LogicBase _owner, LaneManager _lane, Spawnable _type, UIHealth _healthUI, float _damageAmount) { if (init == false) { owner = _owner; lane = _lane; creatureType = _type; uiHealth = _healthUI; damageAmount = _damageAmount; range = _type == Spawnable.Bunny ? TournamentManager._instance.bunnyRange : TournamentManager._instance.unicornRange; init = true; activeLaneNode = lane.GetFirstLaneNode(owner); activeLaneNode.activeCreature = this; owner._Creatures.Add(this); rightFacing = owner._RightFacing; // Debug.Log ("Creature owned by " + owner); } }
private void OnCollisionEnter(Collision collision) { //be able to jump again, when you have hit the ground if (collision.gameObject.tag == "ground") { grounded = true; animator.SetBool("isJumping", false); } //take damage when hit by bullet if (collision.gameObject.tag == "EnemyBullet") { takeDamage(10); if (health <= 0 && !isDead) { isDead = true; UIHealth.IncrementDeadCount(); } } }
void Awake() { instance = this; }
// Start is called before the first frame update void Awake() { // Make this object the only instance instance = this; }
// Use this for initialization void Awake() { Instance = this; }
// Update is called once per frame void Update() { //bad if(mHealthUI == null) { if(UIModalManager.instance != null) { mHealthUI = UIModalManager.instance.transform.parent.GetComponentInChildren<UIHealth>(); if(mHealthUI != null) { mHealthUI.Attach(transform); mHealthUI.gameObject.SetActive(mCurHealth < maxHealth); } } } switch(mCurState) { case State.None: break; case State.RegenWait: mCurTime += Time.deltaTime; if(mCurTime >= regenDelay) { SetState(State.Regen); } break; case State.Regen: mCurHealth += (idleRegen ? regenRateIdle : regenRate) * Time.deltaTime; if(mCurHealth >= maxHealth) { mCurHealth = maxHealth; SetState(State.None); } else { if(mTiler != null) { mTiler.numTiles = minTileRes + (maxTileRes - minTileRes) * (mCurHealth / maxHealth); } ApplyHealthText(); } break; case State.Dead: if(mTiler != null) { mCurTime += Time.deltaTime; if(mCurTime < minTileDeathDelay) { mTiler.numTiles = minTileRes + (mCurTime / minTileDeathDelay) * (minTileDeathRes - minTileRes); } else { mTiler.numTiles = minTileDeathRes; mTiler = null; } } break; } }
void Awake() { Instance = this;//instanciamos est objeto }
// Use this for initialization void Start() { textUI = GetComponent<Text>(); mutex = 215; mutey = 40; health = GameObject.FindObjectOfType<UIHealth>(); regen = GameObject.FindObjectOfType<UIRegen>(); speed = GameObject.FindObjectOfType<UISpeed>(); maturation = GameObject.FindObjectOfType<UIMaturation>(); metabolism = GameObject.FindObjectOfType<UIMetabolism>(); sight = GameObject.FindObjectOfType<UISight>(); mutations = GameObject.FindObjectOfType<UIMutations>(); mute1 = GameObject.FindObjectOfType<UIMute1>(); mute2 = GameObject.FindObjectOfType<UIMute2>(); mute3 = GameObject.FindObjectOfType<UIMute3>(); mute4 = GameObject.FindObjectOfType<UIMute4>(); mute5 = GameObject.FindObjectOfType<UIMute5>(); mute6 = GameObject.FindObjectOfType<UIMute6>(); mute7 = GameObject.FindObjectOfType<UIMute7>(); mute8 = GameObject.FindObjectOfType<UIMute8>(); mute9 = GameObject.FindObjectOfType<UIMute9>(); mute10 = GameObject.FindObjectOfType<UIMute10>(); }
private void Awake() { instance = this; }