public override void Die() { //reset data Freezable f = GetComponent <Freezable>(); if (f != null) { f.Unfreeze(); } SpawnPoint[] spawnPoints = GameObject.FindObjectsOfType <SpawnPoint>(); foreach (SpawnPoint point in spawnPoints) { point.ResetSpawn(); } foreach (PotionSelector.PotionElement potionElement in PotionSelector.GetAllPotionElements()) { potionElement.SetCount(0); } Vector3 checkPointPosition = CheckPointManager.GetCheckPointPos(); transform.position = new Vector3(checkPointPosition.x, checkPointPosition.y, transform.position.z); foreach (SpawnPoint point in spawnPoints) { point.SpawnAll(); } currentHealth = maxHealth; HealthSlider.SetValue(1f); }
public void CreateSliderFor(Unit unit) { HealthSlider slider = Instantiate(sliderPrefab, transform).GetComponent <HealthSlider>(); slider.AssignToUnit(unit); slider.SetColor(teamColors[unit.team]); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var data = new HealthSlider { PlayerId = m_PlayerId }; dstManager.AddComponentData(entity, data); }
public void Initialize() { _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _slider = GameObject.Find("HealthUI").GetComponent <HealthSlider>(); health = 100; damageThreshold = 100; executionsPerformed = 0; alive = true; GetComponent <PlayerMotor>().enabled = true; GetComponent <PlayerControls>().enabled = true; _animator = GetComponent <Animator>(); _characterState = GetComponent <CharacterState>(); }
private void SetUpSingleton() { if (instance == null) { instance = this; } else { if (instance != this) { Destroy(gameObject); } } }
// Start is called before the first frame update private void Awake() { Transform UICanvas = GameObject.FindGameObjectWithTag("UICanvas").transform; if (UICanvas != null) { HealthSlider newHealthUI = Instantiate(healthUIPrefab, UICanvas); newHealthUI.init(healthComponent); HealthSlider bloodUI = Instantiate(bloodUIprefab, UICanvas); bloodUI.init(bloodGauge); } else { Debug.Log("NO UI canvas"); } }
void Start() { self = this; slider = GetComponent <Slider>(); }
public override void Regenerate() { base.Regenerate(); HealthSlider.SetValue(currentHealth / maxHealth); }
public override void TakeDamage(float dmg) { base.TakeDamage(dmg); HealthSlider.SetValue(currentHealth / maxHealth); }
void Start() { slider = GetComponent <Slider>(); instance = this; slider.value = 1f; }
private void Awake() { animator = GetComponent <Animator>(); audioController = FindObjectOfType <AudioController>(); healthSlider = FindObjectOfType <HealthSlider>(); }