public void DestroyLine(GameObject line, HealthPoints playerHealth) { if (onDead) { return; } if (gameObject.tag == "bossEnemy") { boss = GameObject.FindObjectOfType <HA_Movement>().gameObject; boss.GetComponent <EnemyHealth>().CommonDamage(GameObject.FindObjectOfType <HealthPoints>()); } healthLine--; //SoundMng.instance.PlaySound(lineDestructionSound); Destroy(line); if (healthLine <= 0) { gameObject.layer = 12; healthLine = 0; playerHealth.RestoreHealth(deathRestore); SoundMng.instance.PlaySound(enemyDeathSound); onDead = true; } }
void Update() { var zone = GetComponent <CapsuleCollider>(); if (moving_time >= time_to_next_zone && zone_number != 3) { t += Time.deltaTime; { if (transform.parent.localScale.x != minimum) { transform.parent.localScale = new Vector3(Mathf.Lerp(maximum, minimum, t / 20), Mathf.Lerp(maximum, minimum, t / 20), 100); } else { t = 0; maximum = minimum; zone_number++; moving_time = 0; minimum = maximum - 1300;; } } } else { moving_time += Time.deltaTime; } if (!in_zone) { player_stats = player.GetComponent <HealthPoints>(); player_stats.healthp -= 0.001f * zone_number; } }
void Update() { GameObject player = enemy.min_dist; if (player == null) { return; } player_stats = player.GetComponent <HealthPoints>(); if (Vector3.Distance(transform.position, player.transform.position) <= bot_atack_range) { bot_cast_time_left -= Time.deltaTime; CastAnim(bot_cast_time_left); if (bot_cast_time_left <= 0) { player_stats.TakeDamage(); bot_cast_time_left = bot_cast_time; } } else if (Vector3.Distance(transform.position, player.transform.position) > bot_atack_range) { bot_cast_time_left = bot_cast_time; } }
void Update() { Collider2D[] results = new Collider2D[18]; int nCollisions = Physics2D.OverlapCollider(damageZone, contactFilter, results); if (nCollisions > 0) { for (int i = 0; i < nCollisions; i++) { Collider2D otherCollider = results[i]; Collider2D collider = Physics2D.OverlapBox(otherCollider.bounds.center, otherCollider.bounds.size, 0, enemyMask); Vector2 direction; HealthPoints playerHp = otherCollider.GetComponent <HealthPoints>(); if ((playerHp != null) && (gameObject.layer != 12)) { direction = otherCollider.bounds.center - collider.bounds.center; direction.Normalize(); direction.y = 1f; playerHp.DealDamage(20, direction); } } } }
private void Die(HealthPoints healthPoints) { if (healthPoints == _stats.currentHP) { Destroy(gameObject); } }
// public RuntimeAnimatorController tempAnimator; private void Awake() { if (photonView.IsMine) { localPlayer = this; } // we flag as don't destroy on load so that instance survives level synchronization, thus giving a seamless experience when levels load. DontDestroyOnLoad(this.gameObject); HealthPoints = GetComponent <HealthPoints>(); HealthPoints.OnDeath += CheckForGameOver; animator = GetComponent <Animator>(); wallet = new Wallet(); if (photonView.IsMine) { InitAtributes(); } SetPlayerClassAndVisual(); //set name ui var hpBar = GetComponentInChildren <FloatingHPBarUI>(); hpBar.chracterName = photonView.Owner.NickName; }
void Start() { anim = GetComponentInChildren <Animation>(); enemy = gameObject.GetComponent <AI_agr>(); bot_cast_time_left = bot_cast_time; bot = gameObject.GetComponent <HealthPoints>(); }
IEnumerator SetUp() { yield return(new WaitUntil(() => PlayerManager.localPlayer)); healthPoints = PlayerManager.localPlayer.GetComponent <HealthPoints>(); healthPoints.OnHPChange += ChangeValue; }
public Unit(int id, UnitStatsConfig stats) { InstanceId = id; HealthPoints = new HealthPoints(stats.HealthPoints); MovementRange = stats.MovementRange; AttackRange = stats.AttackRange; AttackPoints = stats.AttackPoints; }
private void OnDied(HealthPoints healthPoints) { if(healthPoints==_stats.currentHP) { Close(); _stats = null; } }
public void SetStartInfo() { HealthPoints = 100; Score = 0; txtHealth.text = HealthPoints.ToString(); txtScore.text = Score.ToString(); }
// For cloning. public object Clone() { // We don't clone Cell to avoid recursion. BasicUnit unit = new BasicUnit(null, Facing, Class.Tag); unit.HealthPoints = (Parameter <int>)HealthPoints.Clone(); unit.ActionPoints = (Parameter <int>)ActionPoints.Clone(); return(unit); }
public void ChangeTarget(Transform destination) { var hp = destination.GetComponent <HealthPoints>(); if (hp != null) { target = hp; } }
protected override void Awake() { base.Awake(); moveRange = new Stat(4); attackRange = new Stat(1); attack = new Stat(20); defence = new Stat(1); hp = new HealthPoints(100); }
protected override void Awake() { base.Awake(); moveRange = new Stat(3); attackRange = new Stat(2); attack = new Stat(35); defence = new Stat(0); hp = new HealthPoints(150, 5); }
public Hero(int instanceId, HeroStatsConfig stats) { InstanceId = instanceId; Team = stats.Team; HealthPoints = new HealthPoints(stats.HealthPoints); MaxMovementForce = stats.MaxMovementForce; Attack = AttackFactory.GetAttack(stats.AttackConfig); Ability = AbilityFactory.GetAbility(stats.AbilityConfig); }
void Start() { enemy = gameObject.GetComponent <Ubica_agr>(); bot_cast_time_left = bot_cast_time; bot = gameObject.GetComponent <HealthPoints>(); player = enemy.min_dist; playerstats = player.GetComponent <PlayerStats>(); speed = playerstats.playerspeed; }
protected override void Awake() { base.Awake(); moveRange = new Stat(6); attackRange = new Stat(5); attack = new Stat(25); defence = new Stat(0); hp = new HealthPoints(100); mp = new ManaPoints(100); }
protected virtual bool AddToCurrentHealth(HealthPoints health) { if (HealthContainer.CurrentHealth != HealthContainer.MaxHealth) { HealthContainer.CurrentHealth = HealthPoints.Min(HealthContainer.CurrentHealth + health, HealthContainer.MaxHealth); return(true); } return(false); }
protected virtual bool SubtractFromCurrentHealth(HealthPoints health, HitType hitType) { if (HealthContainer.CurrentHealth == HealthPoints.Zero) { return(false); } HealthContainer.CurrentHealth = HealthPoints.Max(HealthContainer.CurrentHealth - health, HealthPoints.Zero); return(true); }
protected virtual void Awake() { moveRange = new Stat(3); attackRange = new Stat(1); attack = new Stat(10); defence = new Stat(0); leech = new Stat(0); hp = new HealthPoints(100); mp = new ManaPoints(0); }
public override bool Heal(HealthPoints value) { if (AddToCurrentHealth(value)) { AfterHeal.SafeInvoke(); return(true); } return(false); }
private void PlayOnDeathVFX(HealthPoints hp, Projectile projectile) { GameObject onHit = Instantiate( hp.getOnDeathVFX(), projectile.gameObject.transform.position, projectile.gameObject.transform.rotation ); Destroy(onHit, .5f); }
protected override bool SubtractFromCurrentHealth(HealthPoints health, HitType hitType) { if (HealthContainer.CurrentHealth == HealthPoints.Zero || hitType != HitType.Explosion) { return(false); } HealthContainer.CurrentHealth = HealthPoints.Max(HealthContainer.CurrentHealth - health, HealthPoints.Zero); return(true); }
private void PlayOnHitVFX(HealthPoints hp) { GameObject onHit = Instantiate( hp.getOnHitVFX(), gameObject.transform.position, gameObject.transform.rotation ); Destroy(onHit, .5f); }
private void HideIfActive(HealthPoints healthPoints) { if (!isActiveAndEnabled) { return; } if (_stats.currentHP == healthPoints) { Unselect(); } }
public int HealthToRegen = 3; // How many hp bonus will regen public override void PickUpMe(GameObject byObject) { HealthPoints OtherHP = byObject.GetComponent <HealthPoints>(); if (OtherHP != null) { GameManager.Instance.IncreaseGamePoints(PointsOnTake); OtherHP.RegenHP(HealthToRegen); Destroy(gameObject); } }
// Start is called before the first frame update void Start() { Life = this.GetComponent <HealthPoints>(); Attack = this.GetComponent <AttackPoints>(); // Se eu tirar isso vai dar merda? isBossNode = false; setInitialState(); DisplayInHUD(); }
private void OnTriggerEnter2D(Collider2D otherObject) { HealthPoints healthDecrease = otherObject.GetComponent <HealthPoints>(); Enemy enemy = otherObject.GetComponent <Enemy>(); // If projectile collides with enemy then deal damage if (enemy && healthDecrease) { healthDecrease.DealDamage(damageAmount); // Destroy projectile if collided with enemy Destroy(gameObject); } }
public void SetStatsFromInfo(EnemyInfo info) { _name = info.Name; _attackRate = info.AttackRate; _damage = info.Damage; _attackLogic = info.AttackLogic; _moveLogic = info.MoveLogic; _moveLogic.Transform = transform; _moveLogic.Speed = info.MoveSpeed; _moveLogic.SetLayer(); _moveLogic.SetTransform(transform); _hp = new HealthPoints(info.MaxHP); }