void Start() { Motor = GetComponent<EnemyMotor>(); Damagable = GetComponent<Damagable>(); GameHandler.Instance.EnemiesLeftInScene.Add(this.gameObject); this.GetComponent<Damagable>().Damaged += CivilianController_Damaged; }
void Start() { GameHandler.Instance.EnemiesLeftInScene.Add(this.gameObject); Damagable = GetComponent<Damagable>(); WeaponEvents.Attack += WeaponEvents_Attack; Damagable.Damaged += Damagable_Damaged; }
// Use this for initialization void Start () { dmg = GetComponent<Damagable> (); blood_empty = new Texture2D (1,1); blood_empty.SetPixel (1, 1, Color.white); blood_fill = new Texture2D (1,1); blood_fill.SetPixel (1, 1, dmg.color); cameras = GameObject.FindGameObjectsWithTag ("Camera"); //Debug.Log ("Camera Length: "+cameras.Length); fontStyle.fontSize = 25; }
void OnDeath(Damagable died) { for (int i = 0; i < this.AmountToDrop; ++i) { GameObject toSpawn = LootManager.GenerateLootDrop(); if (toSpawn != null) { Instantiate(toSpawn, (Vector2)this.transform.position + new Vector2(Random.Range(-this.MaxDistance, this.MaxDistance), Random.Range(-this.MaxDistance, this.MaxDistance)), Quaternion.identity); } } }
public void ApplyDamage(Damagable other) { _alreadyHitThisUpdate.Add(other.gameObject); if (!other.IgnoreHealthCallbacks) { for (int i = 0; i < _onAttackLandedCallbacks.Count; ++i) { _onAttackLandedCallbacks[i](this, this.Damage, other.IsDead); } } }
private void damagableHit(Damagable damgable, int damage) { if (_dead) return; this.CurrentHealth -= damage; if (this.CurrentHealth <= 0) { Camera.main.GetComponent<ShakeHandler>().ApplyImpact(this.DeathShakeMagnitude); } runCallbacks(); }
void SubBossKilled(Damagable subBoss) { GameObject subBossObject = subBoss.gameObject; _subBosses.Remove(subBossObject); ++_killedSubBosses; foreach (GameObject boss in _subBosses) { boss.GetComponent<BossLoversBehavior>().OtherBosses.Remove(subBossObject); } if (_killedSubBosses < TotalSubBosses) spawnSubBossWave(); else handleLastSubBossKilled(); }
protected virtual bool Hit(RaycastHit hitInfo) { Damagable damagable = hitInfo.collider.GetComponentInParent<Damagable>(); if (damagable != null) { if (damagable.GetTeam() == team) { return false; } if (damage > 0) { damagable.ReceiveDamage(new Damage(damage, damageType)); } } OnHit?.Invoke(damagable); if (hitEffect != null) { GameObject newEffect = Instantiate(hitEffect); newEffect.transform.position = hitInfo.point - velocity.normalized * 0.02f; newEffect.transform.rotation = Quaternion.FromToRotation(Vector3.forward, hitInfo.normal); } Destroy(gameObject); return true; }
void OnTriggerEnter(Collider other) { Damagable targetDamage = other.GetComponent <Damagable>(); if (_user && targetDamage != null && other.gameObject != _user && !other.CompareTag(Tags.DeadBody)) { if (userChar.CanDamageTarget(targetDamage)) { //處發擊中事件 if (hitOnCharacter != null) { hitOnCharacter(targetDamage); } //攻擊或發動技能時可造成傷害 if ((userChar.IsAttacking || userChar.IsSkilling)) { //攻擊(不是放技能) if (!userChar.IsSkilling) { //不在這次打擊過的清單 if (!hitOnOneAttack.Contains(targetDamage)) { //加入 hitOnOneAttack.Add(targetDamage); //攻擊成功 一次傷害判定,若為技能不影響取得傷害的部分 targetDamage.Damage(DamageType.Physical, userChar, userChar); } //已打擊過 else { //啥都不做 return; } } else { //技能觸發OnHitCharacter造成傷害 } } } } }
// Start is called before the first frame update protected void Start() { anim = GetComponent <Animator>(); rend = GetComponentInChildren <Renderer>(); cCollider = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); health = GetComponent <Damagable>(); joint = GetComponent <Joint>(); bodyColliders = new List <Collider>(GetComponentsInChildren <Collider>()); behaveTimer = UnityEngine.Random.value * -1; car = GameObject.FindWithTag("Player"); agent = GetComponentInChildren <NavMeshAgent>(); agent.speed = maxSpeed * 2; agent.acceleration = acceleration * 4; agent.baseOffset = cCollider.height / 2.0f; SetRagDoll(false); }
public void ApplyDamage(Damagable hitDamagable, int amount) { bool targetKilled = hitDamagable.TakeDamage(amount); if (targetKilled) { Player p = hitDamagable.GetComponent <Player>(); if (p != null && (p != this.player) && (p.team != this.player.team)) { player.team.AddPoints(Game.round.mode.playerKillScoreAmount); player.gold += Game.round.mode.playerKillGoldAmount; } Chicken c = hitDamagable.GetComponent <Chicken>(); if (c != null) { player.team.AddPoints(Game.round.mode.chickenKillScoreAmount); player.gold += Game.round.mode.chickenKillGoldAmount; } } }
public void DeathAndRemove(Damagable character) { if (character.GetComponent <Enemy>() != null) { if (order.Remove(character)) { EnemyDeath++; } int index = mutable2.IndexOf(character.GetComponent <Enemy>()); display2[index].enemyDie(); } else { if (order.Remove(character)) { } int index = mutable.IndexOf(character.GetComponent <Hero>()); display[index].GetComponent <Image>().color = Color.red; } }
public List <Damagable> GetDamagables() { List <Damagable> damagableContents = new List <Damagable>(); if (areaCells == null || areaCells.Count == 0) { return(damagableContents); } for (int i = 0; i < areaCells.Count; i++) { Damagable d = areaCells[i].CellContent as Damagable; if (d != null && d.IsOpponent()) { damagableContents.Add(d); } } return(damagableContents); }
void HandleCollision(Damagable other) { // Speed multiplier: // y = log(x) + 0.0005x^2 // Deal damage - only have to do this here since the other // damagable will also have this event trigger and will take away the other // object's health Damagable _this = this.gameObject.GetComponent <Damagable>(); float damageDealt = 0; // Initial damage calculation formula was faaaaaaar too crazy... // Let's flatten the curve a bit. // Pre-calculate damage for parts if (this.gameObject.name == "Wall") { damageDealt = 0.75f * (Damage + Damage * (Mathf.Log(other.Speed) + 0.0005f * Mathf.Pow(other.Speed, 2.0f))); } else { damageDealt = 0.75f * (Damage + Damage * (Mathf.Log(Speed) + 0.0005f * Mathf.Pow(Speed, 2.0f))); } // Pre-hit triggers for the battering ram if (other.gameObject.GetComponent <Basher>() != null) { other.gameObject.GetComponent <Basher>().OnHit(ref _this, damageDealt); } // Walls' damage will scale based on the other object's speed other.Health -= damageDealt * other.Resistance; // Post-hit triggers for battering ram if (other.gameObject.GetComponent <Basher>() != null) { other.gameObject.GetComponent <Basher>().PostHit(ref _this, damageDealt); } }
void CreateHealers() { if (protector1?.health <= 0) { protector1 = null; } if (protector2?.health <= 0) { protector2 = null; } if (protector1 != null && protector2 != null) { curState = BossStates.BeamAttack; BeamAttack(); return; } if (stateTimer < 3) { transform.position = Vector3.Lerp(startLoc, new Vector3(0, 3, 0) + startLoc, stateTimer / 3.0f); transform.forward = Vector3.Lerp(transform.forward, new Vector3(0, -1, 0), 0.5f); } else { var protectPos = transform.position; protectPos.y -= 4.5f; protectPos.x -= 1; if (protector1 == null) { protector1 = Instantiate(protectorPrefab, protectPos, Quaternion.identity).GetComponent <Damagable>(); } protectPos.x += 2; if (protector2 == null) { protector2 = Instantiate(protectorPrefab, protectPos, Quaternion.identity).GetComponent <Damagable>(); } curState = BossStates.HealerCool; } }
// Almost have it working, it's an issue with kinematic colliders private void OnTriggerEnter(Collider other) { Vector3 deltaVelocity = (transform.position - previousPosition) * Time.deltaTime; if (deltaVelocity.magnitude > damageVelocity) { // If the thing we're colliding with can take damage, then inflict it. Damagable damageable = other.GetComponent <Damagable>(); if (damageable != null) { // Only play audio if the target is actually going to take damage if (!damageable.isInvincible && playAudioOnDamage) { audioSource.PlayOneShot(onDamageAudioClip); } // Calculate damage damageable.receiveDamage(damage); } } }
void SubBossKilled(Damagable subBoss) { GameObject subBossObject = subBoss.gameObject; _subBosses.Remove(subBossObject); ++_killedSubBosses; foreach (GameObject boss in _subBosses) { boss.GetComponent <BossLoversBehavior>().OtherBosses.Remove(subBossObject); } if (_killedSubBosses < TotalSubBosses) { spawnSubBossWave(); } else { handleLastSubBossKilled(); } }
protected IEnumerator AttackRoutine() { if (target == null || Vector3.Distance(transform.position, target.transform.position) > range) { target = null; yield return(null); } else { laserRenderer.SetPosition(0, transform.position); laserRenderer.SetPosition(1, target.transform.position); laserRenderer.enabled = true; StartCoroutine("HideLaser"); target.Damage(damage); yield return(new WaitForSeconds(attackInterval)); StartCoroutine("AttackRoutine"); } }
void Start() { health = maxHealth; rb = GetComponent <Rigidbody>(); if (rb == null || includeChildren) { Rigidbody[] rbs = GetComponentsInChildren <Rigidbody>(); foreach (Rigidbody rb in rbs) { if (rb.gameObject != gameObject && !rb.gameObject.GetComponent <Damagable>()) { Damagable damagable = rb.gameObject.AddComponent <Damagable>(); damagable.maxHealth = maxHealth; damagable.health = health; damagable.damageThreshhold = damageThreshhold; damagable.damageMultiplier = damageMultiplier; damagable.healthPool = this; } } } }
public void SortbySpeed() { List <Damagable> temp = new List <Damagable>(); while (order.Count != 0) { Damagable fastest = order[0]; int index = 0; for (int i = 0; i < order.Count; i++) { if (order[index].getSpeed() < order[i].getSpeed()) { fastest = order[i]; index = i; } } temp.Add(fastest); order.RemoveAt(index); } order = temp; }
void OnTriggerEnter2D(Collider2D other) { // return ignored object if (other.gameObject == IgnoreObject) { return; } // return if not contains Damagable script Damagable otherDamagableScript = other.GetComponent <Damagable>(); if (otherDamagableScript == null) { return; } //TODO: what happens when it hits an object with no life scale (like walls) // decrease life & destroy the ammo otherDamagableScript.Life -= this.Damage; Destroy(this.gameObject); }
// Use this for initialization void Start() { myDamagable = gameObject.GetComponent <Damagable>(); myDamagable.deathDel = OnPlayerDeath; myDamagable.playerUpDel = OnPlasmaWound; CPCS = FindObjectOfType <ControlPanelCanvasScript>(); CSP = FindObjectOfType <CommonSceneParams>(); //myDamagable.currentHealth = CSP.pIH; //myDamagable.currentShield = CSP.pIS; myDamagable.myObject = gameObject; playerCamera.transform.localPosition = cameraGamePosition; cameraShipDist = Vector3.Distance(playerCamera.transform.localPosition, shipObject.transform.localPosition); cameraMoveAlong = new Vector3(0.0f, 12.0f, -36.0f); cameraMoveAlong.Normalize(); subtimer = 0.0f; vortexDeltaTime = 0.01f; //playerCamera.GetComponent<Animator>().enabled = false; }
private IEnumerator SetCharge() { yield return(new WaitForSeconds(this.chargeTime)); Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, this.explosionRadius); for (int i = 0; i < hitColliders.Length; ++i) { Damagable hitDamagable = hitColliders[i].GetComponent <Damagable>(); if (hitDamagable != null && hitDamagable.GetComponent <BigEgg>() == null) { this.bombAbility.ApplyDamage(hitDamagable, this.bombAbility.damageAmount); } } OnActivate.Invoke(); Instantiate(this.explosion, this.transform.position, this.explosion.transform.rotation); this.model.SetActive(false); Destroy(this.gameObject, this.explodeTime); }
public void OnCollide(LocalEventNotifier.Event localEvent) { CollisionEvent collision = localEvent as CollisionEvent; foreach (GameObject hit in collision.Hits) { if (this.CollisionWeaponType != null && this.CollisionWeaponType.SpecialEffect == WeaponType.SPECIAL_EXPLOSION && ((1 << hit.layer) & this.GetComponent <Damager>().DamagableLayers) != 0) { // Explode on impact Damagable damagable = this.GetComponent <Damagable>(); while (damagable.Health > 0) { damagable.ReceiveDamage(this.GetComponent <Damager>()); } } else if (((1 << hit.layer) & this.BounceLayerMask) != 0) { _actor.Bounce(hit, collision.VelocityAtHit, collision.VelocityApplied, this.BounceLayerMask, 0.0f); break; } } }
// Take away this shield's health instead public override void OnHit(ref Basher basher, ref Damagable target, float damage) { base.OnHit(ref basher, ref target, damage); // If the damage is less than the shield's remaining health, add the // damage to the basher's health. This will effectively bring the damage // taken to 0. if (damage < Health) { damagable.Health += damage; Health -= damage; } // If the damage is greater than the shield's remaining health, just add all // of that to the basher's health and remove it if (damage > Health) { damagable.Health += Health; Health = 0; } // Destroy the shield if its HP goes below 0 if (Health <= 0) { // Find this part's ID in the basher parts list int idToRemove = -1; for (int i = 0; i < basher.parts.Length; i++) { if (basher.parts[i] == this) { idToRemove = i; break; } } // Remove this from the parts list basher.RemovePart(idToRemove); } }
private void OnTriggerEnter(Collider other) { if (weapon == null) { Debug.Log("No weapon declared for me! " + this.gameObject.name + " (" + this.transform.parent.gameObject + ") "); return; } DamagableMarker marker = other.GetComponent <DamagableMarker>(); Damagable damageManager = other.GetComponent <Damagable>(); if (marker != null) { weapon.WeaponTriggerEnter(marker); } else if (damageManager != null) { weapon.WeaponTriggerEnter(damageManager); } }
private void Attack() { Collider[] colliders = Physics.OverlapSphere(transform.position + (transform.forward * 2.5f), 1.5f); foreach (Collider col in colliders) { Damagable damagable = col.GetComponent <Damagable>(); if (col.tag == "Player") { damagable = Game.instance.player.GetComponent <Damagable>(); } if (damagable == null || col.tag == "Bear") { continue; } damagable.TakeDamage(attackDamage, transform.forward); } attackTime = 3.0f; }
public void HitEvent(float radius = 0.3f, float damageActionScale = 1.0f, Vector3 sphereOffset = default(Vector3), bool relativeHit = false) { //GameObject checkSphere = GameObject.Find("Body/rightHand"); Collider[] hitObj = Physics.OverlapSphere(checkSphere.transform.position + sphereOffset, radius); Debug.Log("qqqq1"); foreach (Collider c in hitObj) { Debug.Log("qqqq2"); Debug.Log(c.gameObject.tag); Damagable cDamamgable = c.gameObject.GetComponent <Damagable>(); if (c.gameObject != gameObject && cDamamgable != null) { Debug.Log("qqqq3"); if (relativeHit) { cDamamgable.Damage((c.transform.position - gameObject.transform.position).normalized * damageActionScale, ATK); } else { cDamamgable.Damage(gameObject.transform.forward * damageActionScale, ATK); } } } }
public void setBaseComponents() { if (foundAllBaseComponents) { return; } genericAI = GetComponent <GenericEnemy>(); DamageManager = GetComponentInChildren <Damagable>(); if (genericAI != null) { genericAI.controller = this; } if (genericAI != null && DamageManager != null) { this.foundAllBaseComponents = true; this.DamageManager.genericAI = genericAI; } }
IEnumerator SpawnEnemy() { yield return(new WaitForSeconds(spawnDelay)); int randEnemy = Random.Range(0, enemyVariant.Length); int randSpawn = Random.Range(0, spawnPoints.Length); GameObject enemy = Instantiate(enemyVariant[randEnemy], spawnPoints[randSpawn].position, spawnPoints[randSpawn].rotation); Damagable enemyDamagable = enemy.GetComponent <Damagable>(); enemyDamagable.onDie.AddListener(() => CountDie(randEnemy)); enemySpawned += 1; if (enemySpawned >= enemyToBeSpawned) { // Finish } else { StartCoroutine(SpawnEnemy()); } }
private IEnumerator spawnWave(Wave wave, float waveDelay) { yield return(new WaitForSeconds(waveDelay)); enemiesCompletedNavigation = 0; enemiesDestroyed = 0; for (int i = 0; i < wave.getNumEnemies(); i++) { Path path = wave.getPath(); var enemy = Instantiate(wave.getEnemy(), path.getWaypoints()[0].position, Quaternion.identity); Navigable navigable = enemy.GetComponent <Navigable>(); navigable.setPath(path); navigable.setMoveSpeed(wave.getMoveSpeed()); navigable.registerOnNavigationComplete(() => { Destroy(enemy); enemiesCompletedNavigation++; }); navigable.setIsLooping(wave.getIsLooping()); Damagable damagable = enemy.GetComponent <Damagable>(); damagable.registerOnKilled((shipInfo) => { enemiesDestroyed++; }); yield return(new WaitForSeconds(wave.getSpawnTime())); } }
// Collision detection void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.gameObject.name != "wheel" && this.gameObject.name != "wheel") { // Check if the collider is a Damagable if (collision.collider.gameObject.GetComponent <Damagable>() != null) { // Handle the Damagable effects Damagable other = collision.collider.gameObject.GetComponent <Damagable>(); HandleCollision(other); } else if (collision.collider.transform.parent != null) // fixes an error that arose when putting the terrain's collider onto the parent { if (collision.collider.transform.parent.GetComponent <Damagable>() != null) { // for objects who have their colliders as children Damagable other = collision.collider.transform.parent.GetComponent <Damagable>(); HandleCollision(other); } } } }
///////////////// ///// DEATH ///// ///////////////// /** * */ public void OnDeath(Damagable damagable) { if (checkpoint && checkpoint.active) { checkpoint.Respawn(this); damagable.Revive(); } else { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }
private void OnEnable() { damagable = GetComponentInParent <Damagable>(); damagable.DamageEvent += OnDamage; }
void Start() { dmg = GameObject.FindGameObjectWithTag("Player").GetComponent<Damagable>(); StartCoroutine(GiveOxygen()); }
/** * */ public void Start() { scale = scale * Camera.main.orthographicSize; player = GetComponent<Player>(); collector = GetComponent<Collector>(); damagable = GetComponent<Damagable>(); labelLeftStyle = new GUIStyle(); labelLeftStyle.alignment = TextAnchor.MiddleLeft; labelLeftStyle.normal.textColor = Color.white; labelCenterStyle = new GUIStyle(); labelCenterStyle.alignment = TextAnchor.MiddleCenter; labelCenterStyle.normal.textColor = Color.white; labelRightStyle = new GUIStyle(); labelRightStyle.alignment = TextAnchor.MiddleRight; labelRightStyle.normal.textColor = Color.white; if (fullHealthUnitSprite) { fullHealthUnitTexture = fullHealthUnitSprite.texture; fullHealthUnitRectangle = fullHealthUnitSprite.textureRect; fullHealthUnitCoordinates = new Rect( fullHealthUnitRectangle.x / fullHealthUnitTexture.width, fullHealthUnitRectangle.y / fullHealthUnitTexture.height, fullHealthUnitRectangle.width / fullHealthUnitTexture.width, fullHealthUnitRectangle.height / fullHealthUnitTexture.height ); } if (emptyHealthUnitSprite) { emptyHealthUnitTexture = emptyHealthUnitSprite.texture; emptyHealthUnitRectangle = emptyHealthUnitSprite.textureRect; emptyHealthUnitCoordinates = new Rect( emptyHealthUnitRectangle.x / emptyHealthUnitTexture.width, emptyHealthUnitRectangle.y / emptyHealthUnitTexture.height, emptyHealthUnitRectangle.width / emptyHealthUnitTexture.width, emptyHealthUnitRectangle.height / emptyHealthUnitTexture.height ); } if (coinUnitSprite) { coinUnitTexture = coinUnitSprite.texture; coinUnitRectangle = coinUnitSprite.textureRect; coinUnitCoordinates = new Rect( coinUnitRectangle.x / coinUnitTexture.width, coinUnitRectangle.y / coinUnitTexture.height, coinUnitRectangle.width / coinUnitTexture.width, coinUnitRectangle.height / coinUnitTexture.height ); } if (keyUnitSprite) { keyUnitTexture = keyUnitSprite.texture; keyUnitRectangle = keyUnitSprite.textureRect; keyUnitCoordinates = new Rect( keyUnitRectangle.x / keyUnitTexture.width, keyUnitRectangle.y / keyUnitTexture.height, keyUnitRectangle.width / keyUnitTexture.width, keyUnitRectangle.height / keyUnitTexture.height ); } if (aButtonSprite) { aButtonTexture = aButtonSprite.texture; aButtonRectangle = aButtonSprite.textureRect; aButtonCoordinates = new Rect( aButtonRectangle.x / aButtonTexture.width, aButtonRectangle.y / aButtonTexture.height, aButtonRectangle.width / aButtonTexture.width, aButtonRectangle.height / aButtonTexture.height ); } if (bButtonSprite) { bButtonTexture = bButtonSprite.texture; bButtonRectangle = bButtonSprite.textureRect; bButtonCoordinates = new Rect( bButtonRectangle.x / bButtonTexture.width, bButtonRectangle.y / bButtonTexture.height, bButtonRectangle.width / bButtonTexture.width, bButtonRectangle.height / bButtonTexture.height ); } if (xButtonSprite) { xButtonTexture = xButtonSprite.texture; xButtonRectangle = xButtonSprite.textureRect; xButtonCoordinates = new Rect( xButtonRectangle.x / xButtonTexture.width, xButtonRectangle.y / xButtonTexture.height, xButtonRectangle.width / xButtonTexture.width, xButtonRectangle.height / xButtonTexture.height ); } if (yButtonSprite) { yButtonTexture = yButtonSprite.texture; yButtonRectangle = yButtonSprite.textureRect; yButtonCoordinates = new Rect( yButtonRectangle.x / yButtonTexture.width, yButtonRectangle.y / yButtonTexture.height, yButtonRectangle.width / yButtonTexture.width, yButtonRectangle.height / yButtonTexture.height ); } if (lButtonSprite) { lButtonTexture = lButtonSprite.texture; lButtonRectangle = lButtonSprite.textureRect; lButtonCoordinates = new Rect( lButtonRectangle.x / lButtonTexture.width, lButtonRectangle.y / lButtonTexture.height, lButtonRectangle.width / lButtonTexture.width, lButtonRectangle.height / lButtonTexture.height ); } if (rButtonSprite) { rButtonTexture = rButtonSprite.texture; rButtonRectangle = rButtonSprite.textureRect; rButtonCoordinates = new Rect( rButtonRectangle.x / rButtonTexture.width, rButtonRectangle.y / rButtonTexture.height, rButtonRectangle.width / rButtonTexture.width, rButtonRectangle.height / rButtonTexture.height ); } }
private void shooterDied(Damagable died) { _shooters.Remove(died); }
public void Hide() { gameObject.SetActive(false); _damagable = null; }
public void EnemyDied(Damagable died) { --enemyCount; }
private void SubBossKilled(Damagable died) { this.SubBosses.Remove(died.gameObject); if (this.SubBosses.Count == 0) { onDeath(0); } else if (_stateMachine.CurrentState == RETURNING_STATE) checkReturnsComplete(); }
virtual protected void onDamageCaused(Damagable damagable) { }
private void subDeath(Damagable sub) { this.BossSubs.Remove(sub.GetComponent<BossMasterSubBehavior>()); }
private void shooterDeath(Damagable shooter) { this.Shooters.Remove(shooter); //this.BossGroups.Remove(shooter.transform.parent.GetComponent<BossMasterGroupBehavior>()); }
public void GameOver(Damagable winner) { isGameOver = true; gameOverText.gameObject.SetActive(true); gameOverText.DOFade(1.0f, 1.5f).OnComplete(() => (mGameStage = GameStage.GameOver)); //mGameStage = GameStage.GameOver; gameOverText.text = "WINNER " + winner.name + " !"; }
private void minionDied(Damagable died) { _minions.Remove(died); }
public void Show(Damagable damagable) { gameObject.SetActive(true); _damagable = damagable; }
private void SubBossKilled(Damagable died) { this.SubBosses.Remove(died.gameObject); if (this.SubBosses.Count == 0) { this.EndFlowObject.GetComponent<WinCondition>().EndLevel(); } }
private void died(Damagable d) { GlobalEvents.Notifier.SendEvent(new PlayerDiedEvent(this.gameObject, this.PlayerIndex)); }
private void onDeath(Damagable damagable) { if (this.CollisionWeaponType != null && this.CollisionWeaponType.SpecialEffect == WeaponType.SPECIAL_EXPLOSION) { AllegianceInfo info = this.GetComponent<AllegianceColorizer>().AllegianceInfo; LayerMask damagableLayers = this.GetComponent<Damager>().DamagableLayers; Bullet.CreateExplosionEntity(this.transform.position, this.ExplosionPrefab, info, this.gameObject.layer, damagableLayers, this.CollisionWeaponType); } }
private void healthUpdated(Damagable player, int damage) { this.UpdateLength(player.Health, player.MaxHealth); }
private void SubBossKilled(Damagable died) { this.SubBosses.Remove(died.gameObject); }
private void SubBossKilled(Damagable died) { this.SubBosses.Remove(died.gameObject); BossWeakSubBehavior sub = died.GetComponent<BossWeakSubBehavior>(); _ogPositionsToSpawn.Add(sub.OGPosition); if (!sub.AttackFinished) { --_attacksToFinish; if (_attacksToFinish == 0 && _stateMachine.CurrentState == ATTACKING_STATE) _timedCallbacks.AddCallback(this, switchState, this.DelayAfterAttackPhase); } }
private void Start() { subject = GetComponent <Damagable>(); subject.onDamage += ResetCooldown; }
override protected void onDamageCaused(Damagable damagable) { if (damagable.gameObject.tag == "Player") { damagable.gameObject.GetComponent<Originate> ().goToOrigin (); } }
private void OnDamage(Damagable obj) { midleground.DOFillAmount(obj.Health / obj.HealthMax, 0.5f); foreground.fillAmount = obj.Health / obj.HealthMax; foreground.color = Color.Lerp(lowHPColor, fullHPColor, foreground.fillAmount); }
private void SubBossKilled(Damagable died) { GameObject killedObject = died.gameObject; this.SubBosses.Remove(killedObject); if (this.SubBosses.Count == 0) { onDeath(); } RadialDistancing.RadialElement? radialElement = null; foreach (RadialDistancing.RadialElement element in _radius.RadialElements) { if (element.transform.gameObject == killedObject) { radialElement = element; break; } } if (radialElement.HasValue) _radius.RadialElements.Remove(radialElement.Value); }
private void damagableDied(Damagable damagable) { this.Damagables.Remove(damagable); }
// Use this for initialization void Start () { mRigidbody = transform.GetComponent<Rigidbody>(); mCollider = transform.GetComponent<Collider>(); mAnimator = transform.GetComponent<Animator>(); mDamagable = transform.GetComponent<Damagable>(); GameObject mainBody = transform.Find("Body").gameObject; mBodyRenderers = new List<Renderer>(mainBody.transform.GetComponentsInChildren<Renderer>()); mGroundCheck = transform.FindChild("groundCheck").transform; mAttackRange = transform.FindChild("attackRange").GetComponent<Collider>(); mGroundTrigger = transform.FindChild("groundCheckCollider").GetComponent<TriggerChecker>(); mHeadCheck = transform.FindChild ("headCheckCollider").GetComponent<Collider> (); }
private void onDeath(Damagable died) { _dead = true; for (int i = 0; i < this.Subs.Length; ++i) { this.Subs[i].Kill(0.0f); } _lerpMovement.HaltMovement(); _timedCallbacks.AddCallback(this, destroy, 0.2f); if (this.DeathCallback != null) DeathCallback(died); }