public void acceptDamage(DamageAcceptorRegistry.DamageArgs argInArgs) { if (destructible) { float locDamage = argInArgs.dmg; if (locDamage > 0) { if (hitPoints > locDamage) { hitPoints -= locDamage; locDamage = 0; } else { hitPoints = 0; Invoke("Destruct", 0.02f); DamageProvider dp = argInArgs.source.GetComponent <DamageProvider>(); if (dp != null) { dp.ReportKill(this); } } } } Push(argInArgs.knockback); }
private void OnTriggerEnter(Collider other) { DamageProvider dp = other.GetComponentInParent <DamageProvider>(); if (dp != null) { _currHealth -= dp.Damage; if (_currHealth > _maxHealth) { _currHealth = _maxHealth; } if (_currHealth <= 0) { Died(dp.Damage); if (DieEvent != null) { DieEvent(this); } } else { Damaged(dp.Damage); if (DamageEvent != null) { DamageEvent(this); } } Destroy(dp.gameObject); } _isDamaged = _currHealth < _maxHealth; }
protected override IEnumerable<DynamicProvider> TemplatingArguments() { thornsProvider = new DamageProvider(2); yield return Attack; yield return Defense; yield return thornsProvider.Provider; }
private void Start() { lr = GetComponent <LineRenderer> (); lr.SetVertexCount(0); UpdateFromMaterialChange(); dp = GetComponent <DamageProvider>(); }
public override bool Engage(Vector3 newTarget) { bool result = false; if ((Time.time - previousShotTime) >= (1f / fireRate)) { GameObject proj = Instantiate(Resources.Load(projectileResourceName, typeof(GameObject)), barrel.transform.position, Quaternion.FromToRotation(Vector3.right, newTarget - this.transform.position)) as GameObject; previousShotTime = Time.time; proj.transform.parent = gpParent.transform; DamageProvider dp = GetComponentInParent <DamageProvider>(); if (dp != null) { proj.GetComponent <Projectile>().damageSource = ((Component)dp).gameObject; } else { proj.GetComponent <Projectile>().damageSource = this.gameObject; } proj.GetComponent <Projectile>().damage = damage; audioSource.Play(); result = true; } return(result); }
void Start() { line = GetComponentInChildren <LineRenderer> (); cc = GetComponentInChildren <CapsuleCollider> (); l = GetComponentInChildren <Light> (); dp = GetComponentInChildren <DamageProvider>(); }
public virtual void acceptDamage(DamageAcceptorRegistry.DamageArgs argInArgs) { //Debug.Log("AIAcceptDmg" + argInArgs.dmg); if (this.gameObject == null) { return; } if (stats.isDead) { return; } float locDamage = argInArgs.dmg; if (stats.currentArmorPoints > 0) { if (stats.currentArmorPoints > locDamage) { stats.currentArmorPoints -= locDamage; locDamage = 0; } else { stats.currentArmorPoints = 0; locDamage -= stats.currentArmorPoints; } } if (locDamage > 0) { if (stats.currentHitPoints > locDamage) { stats.currentHitPoints -= locDamage; locDamage = 0; Knockback(argInArgs.knockback); } else { stats.currentHitPoints = 0; stats.isDead = true; DamageProvider dp = argInArgs.source.GetComponent <DamageProvider>(); if (dp != null) { dp.ReportKill(this); } Die(argInArgs); } } Transform healthbar = transform.Find("HealthBar"); if (healthbar != null) { healthbar.transform.Find("Level").GetComponent <Image>().fillAmount = stats.currentHitPoints / stats.totalHitPoints; } }
public override void Apply(string guid) { Minion minion = GameState.GetMinion(guid); if (minion != null) { DamageProvider damage = new DamageProvider(minion.Durability); TargetingRequirements allMinions = new TargetingRequirements( (int)TargetTypeFlag.Friendly | (int)TargetTypeFlag.Enemy | (int)TargetTypeFlag.Minion, global::TargetingType.All ); foreach (string targetGuid in allMinions.AllowedTargets()) { damage.Apply(targetGuid, minion.GUID); } } }
void Start() { deadline = Time.time + time; active = true; dp = GetComponent <DamageProvider>(); }
public Minion() { GUID = Guid.NewGuid().ToString(); damageProvider = new MinionDamageProvider(this); }
void Start() { origin = transform.position; dp = GetComponentInChildren <DamageProvider> (); }
protected override System.Collections.Generic.IEnumerable<DynamicProvider> TemplatingArguments() { Damage = new ActiveMorphidDamageProvider(0, () => lastCostCheck * 2); yield return Damage.Provider; }
private void OnCollisionEnter(Collision collision) { DamageProvider = collision.gameObject.GetComponent <DamageProvider>(); }
public void DoLateUpdate() { DamageProvider = null; }
void Start() { dp = GetComponent <DamageProvider>(); }