public void onHit() { if (isEnabled) { if (_health.isAlive) { _playerHealth.Add(onHitAmount); } else { _playerHealth.Add(onKillAmount); } } }
public void Load(string value) { var lines = File.ReadAllLines(value); foreach (var line in lines) { if (line.ToLower().Contains("example") || line.ToLower().Contains("[spells]")) { //Ignore } else { var temp = line.Split('_'); SpellNames.Add(temp[0]); Health.Add(Convert.ToInt32(temp[1])); SpellKeys.Add(temp[2]); CastTime.Add(Convert.ToInt32(temp[3])); Mana.Add(Convert.ToInt32(temp[4])); Range.Add(Convert.ToInt32(temp[5])); Type.Add(temp[6]); Combo.Add(Convert.ToInt32(temp[7])); MinDistance.Add(Convert.ToInt32(temp[8])); EnemyHealth.Add(Convert.ToInt32(temp[9])); } } }
private void PullHeat(GameObject a_target) { if (m_health.Count == m_health.Maximum && m_ammoCounter.Count == m_ammoCounter.Maximum) { StopCharge(); return; } var lava = a_target.GetComponent <Lava>(); if (lava == null) { StopCharge(); return; } var heat = lava.PullHeat(); if (heat == 0) { StopCharge(); return; } if (m_health.Count < m_health.Maximum) { m_health.Add(heat * 3); } else { m_ammoCounter.Add(heat); } }
/// <summary> Spawns a random entity in the world </summary> public void SpawnEntity() { NPC entity = null; switch (random.Next(0, 3)) // Number is >= 0 and < 3 { // Monster case 0: entity = RandomMonster(); Monsters.Add((Monster)entity); this.Controls.Add(entity); break; // Money case 1: entity = RandomMoney(); Money.Add((Money)entity); this.Controls.Add(entity); break; // Health case 2: entity = RandomHealth(); Health.Add((Health)entity); this.Controls.Add(entity); break; default: break; } }
public void OnGetShot(GameObject from, float damage) { health.Add(-damage); MainCanvas.Instance.UpdateHealth(); if (health.IsDead()) { StopAllCoroutines(); gameObject.SetActive(false); //GameOver if (OnPlayerDeath != null) { OnPlayerDeath(); } MainCanvas.Instance.EnableGameOver(true); } }
public void UpdateLogs(Fighter fighter) { Hits.Add(fighter.Hits); Health.Add(fighter.HealthPoints); DealtDamage.Add(fighter.DealtDamage); Rounds.Add(fighter.Rounds); if (!fighter.IsAlive()) { Deaths++; } }
/* * Purpose: Add object to caravan. * Effects: Part's parent is now 1 of 12 transforms children of the caravan (caravan is now grandparent!) * Input/Output: N/A. * Global Variables Used: caravan_tf, part_slot_tf, caravan, char_control (Class InteractWithCaravan), transform, parts_tf (Class Caravan), * transform (Class Part), has_object (Class CharacterControl), Player_Inventory.CaravanPart, */ public void AddToCaravan() { Part part = transform.GetChild(0).GetChild(0).GetComponent <Part>(); part_slot_tf = caravan.FindPartSlot(part.transform); part.AttachTo(part_slot_tf); caravan.parts_tf.Add(part.transform); p_inv.CaravanPart -= 1; health.Add(part.healthValue); }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.CompareTag("Food")) { col.gameObject.SetActive(false); audioSource.PlayOneShot(eatingSound); health.Add(); if (!handicap.teeth) { timeOut = 3.0f; } } }
public void OnGetBombed(float damage) { if (health != null) { health.Add(-damage); if (health.IsDead()) { gameObject.SetActive(false); personality = null; if (Diagnostic.Instance.enemyReference == gameObject) { Diagnostic.Instance.enemyReference = null; } } } Diagnostic.Instance.UpdateHealth(this.gameObject, health.GetHealth()); if (personality != null) { personality.OnGetBombed(); } }
private void OnTriggerEnter2D(Collider2D collider) { string tag = collider.gameObject.tag; if (tag == "Checkpoint") { lastCheckpoint = collider.gameObject.transform.position; } else if (tag == "Kill") { transform.position = lastCheckpoint; } if (tag == "health") { if (health.currentHealth < 10) { health.Add(1); } Destroy(collider.gameObject); lastCheckpoint = gameObject.transform.position; } }
private void Heal(int value) { Health health = _player.GetComponent <Health>(); health.Add(value); }
public void CanAddHealth() { health.Add(100); Assert.AreEqual(200, health.health); }