public void DecreaseHP(int incomingDmg, PlayerInfo attacker) { float f = incomingDmg; f -= (incomingDmg * stats.incomingDmgReduc); incomingDmg = Mathf.RoundToInt(f); //only for lifesteal if (attacker != null) { float healMult = (attacker.invStats.lifeSteal / 100f); int healValue = Mathf.RoundToInt(f * healMult); //Debug.Log("LIFESTEAL" + healValue); attacker.AddHP(healValue); } stats.hpCur -= incomingDmg; if (stats.hpCur < 0) { stats.hpCur = 0; } hpCon.RefreshHpBar(); hpCon.CheckIfDead(); Vector3 placeHere = new Vector3(pos.x, pos.y, -1); assetsLib.CreateDamageText(placeHere, incomingDmg); }
void OnTriggerEnter(Collider other) { if (other.tag == "Boundary") { return; } if (other.tag == "Skill") { Instantiate(boltExplosion, transform.position, transform.rotation); Destroy(gameObject); } if (other.tag == "Enemy") { return; } if (other.tag == "Boss") { return; } if (other.tag == "playerbolt") { return; } if (other.tag == "Skill") { Instantiate(boltExplosion, transform.position, transform.rotation); Destroy(gameObject); } if (other.tag == "Player") { Instantiate(boltExplosion, transform.position, transform.rotation); playerInfo.AddHP(-1); gameController.UpdateHP(); Destroy(gameObject); if (playerInfo.HP > 0) { return; } Instantiate(playerExplosion, transform.position, transform.rotation); gameController.GameOver(); other.gameObject.GetComponent <SpriteRenderer> ().enabled = false; other.gameObject.GetComponent <PlayerController> ().stop = true; } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (itemNum == 1) { playerInfo.AddHP(1); } else if (itemNum == 2) { playerInfo.AddPW(); } Instantiate(text, textSpawn.position, textSpawn.rotation); Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Boundary") { return; } if (other.tag == "Enemy") { return; } if (other.tag == "Boss") { return; } if (other.tag == "bg") { return; } if (other.tag == "power") { AddHP(-0.2f); Destroy(other.gameObject); Instantiate(boltExplosion, transform.position, transform.rotation); } if (other.tag == "playerbolt") { AddHP(-1); Destroy(other.gameObject); Instantiate(boltExplosion, transform.position, transform.rotation); } if (other.tag == "Player") { playerInfo.AddHP(-1); gameController.UpdateHP(); if (enemyNum < 3) { Instantiate(explosion, transform.position, transform.rotation); } else if (enemyNum == 3) { Instantiate(Colexplosion, transform.position, transform.rotation); } if (enemyNum < 4) { Destroy(gameObject); } c = true; if (playerInfo.HP > 0) { return; } Instantiate(playerExplosion, transform.position, transform.rotation); other.gameObject.GetComponent <SpriteRenderer> ().enabled = false; other.gameObject.GetComponent <PlayerController> ().stop = true; gameController.GameOver(); } if (HP <= 0 && c == false) { Instantiate(explosion, transform.position, transform.rotation); gameController.AddScore(scoreValue); if (enemyNum == 4) { gameController.BossUpdate(); } Destroy(gameObject); } }