void Update() { deltaTime += Time.deltaTime; if (deltaTime > 0.013f) { duration -= deltaTime; transform.localPosition += new Vector3(mineSpeed, yChangeRate, 0.0f); //transformSprite.Rotate(0.0f, 0.0f, rotateAmount); //transform.localEulerAngles = new Vector3(0.0f, 0.0f, transform.localEulerAngles.z + rotateAmount); mineSpeed = Mathf.Max(0.0f, mineSpeed - (0.125f * deltaTime)); float yPosition = transform.localPosition.y; if (((yPosition >= peak && yChangeRate > 0) || (yPosition < peak && yChangeRate <= 0)) && !peaked) { peaked = true; yChangeRate = 0.0f; } deltaTime = 0.0f; } if (duration <= 0.0f) { prefabPools.CreateExplosion(transform, 0.25f); PushOnStack(); } }
void OnCollisionEnter(Collision col) { if (notYetHitEnemy) { if (col.gameObject.tag == "Enemy") { float damage = gameManager.upgradeValues[33, PlayerStats.playerStats.upgradeStatus[33]]; notYetHitEnemy = false; Enemy enemy = col.gameObject.GetComponent <Enemy>(); prefabPools.CreateExplosion(transform, 0.13f); if (enemy.enemyHP <= damage) { gameManager.missionTracker.IncrementMissionProgress(2, 1); } enemy.EnemyTakeDamage(damage, 1.0f, false); PushOnStack(); } else if (col.gameObject.tag == "Asteroid") { float damage = gameManager.upgradeValues[33, PlayerStats.playerStats.upgradeStatus[33]]; notYetHitEnemy = false; prefabPools.CreateExplosion(transform, 0.13f); col.gameObject.GetComponent <Asteroid>().EnemyTakeDamage(damage, 1.0f); PushOnStack(); } } }
void OnCollisionEnter(Collision col) { string colTag = col.gameObject.tag; if (colTag == "Enemy") { if (notYetHitEnemy) { notYetHitEnemy = false; if (type != 1) { prefabPools.CreateExplosion(transform, 0.22f); col.gameObject.GetComponent <Enemy>().EnemyTakeDamage(damage, knockback, false); } else { col.gameObject.GetComponent <Enemy>().ActivateDamageOverTime(damage, intensity + 4, 0); } PushOnStack(); } } else if (colTag == "Asteroid") { if (notYetHitEnemy) { notYetHitEnemy = false; if (type != 1) { prefabPools.CreateExplosion(transform, 0.22f); col.gameObject.GetComponent <Asteroid>().EnemyTakeDamage(damage, 1.0f); } else { col.gameObject.GetComponent <Asteroid>().ActivateDamageOverTime(damage, intensity + 4, 0); } PushOnStack(); } } else if ((colTag == "EnemyProjectileRocket" || colTag == "EnemyProjectileFire" || colTag == "EnemyProjectileLaser" || colTag == "EnemyProjectileAcid" || colTag == "EnemyProjectileDrain" || colTag == "EnemyProjectileWeaken") && type == 2) { if (notYetHitEnemy) { notYetHitEnemy = false; prefabPools.CreateExplosion(transform, 0.1f); col.gameObject.GetComponent <EnemyProjectile>().PushOnStack(); PushOnStack(); } } }
void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Enemy") { Enemy enemy = col.gameObject.GetComponent <Enemy>(); if (!enemy.AlreadyHit(armamentIdRandom)) { prefabPools.CreateExplosion(enemy.transform, 0.16f); enemy.EnemyTakeDamage(damage, knockback, true); } } else if (col.gameObject.tag == "Asteroid") { Asteroid asteroid = col.gameObject.GetComponent <Asteroid>(); if (!asteroid.AlreadyHit(armamentIdRandom)) { prefabPools.CreateExplosion(asteroid.transform, 0.16f); asteroid.EnemyTakeDamage(damage * 0.6f, knockback); } } }
public void Explode() { ship.PlayerTakeDamage(damage); //prefabPools.CreateExplosion(transform, 0.35f); Icon parentIcon = GetComponentInParent <Icon>(); if (parentIcon != null) { parentIcon.DeactivateBomb(); } board.ModuleDestroyIcon(attachedColumn, attachedRow, 0); prefabPools.CreateExplosion(ship.transform, 0.25f); }
void OnCollisionEnter(Collision col) { if ((enemyID == 11 || enemyID == 50) && col.gameObject.tag == "Ship") { prefabPools.CreateExplosion(col.transform, 0.5f); ship.PlayerTakeDamage(enemyDamage); gameManager.ChangeFunds(Mathf.CeilToInt(moneyReward)); space.EnemyDefeated(microEnemy); space.DestroyEnemy(this); } }
public void EnemyTakeDamage(float damageValue, float pushBack) { if (enemyHP > 0) { enemyHP -= damageValue; space.CreateTextDamage(damageValue, transform.localPosition.x, transform.localPosition.y, true); if (enemyHP <= 0) { int moneyRewardInt = Mathf.CeilToInt(moneyReward); prefabPools.CreateExplosion(transform, 0.33f); space.ChangeNumberOfEnemies(-10); gameManager.board.CreateMatchText(4, moneyRewardInt); gameManager.ChangeFunds(moneyRewardInt); space.AsteroidDestroyed(); PushOnStack(); } else { AdjustHPBar(); } } }
void OnCollisionEnter(Collision col) { GameObject objectCollision = col.gameObject; string collisionTag = objectCollision.tag; if (collisionTag == "Ship") { if (!ship.CheckReflection() && !ship.CheckRedirection()) { if (projectileType == "EnemyProjectileLaser") { prefabPools.CreateExplosion(transform, 0.16f); ship.PlayerTakeDamage(projectileDamage); } else if (projectileType == "EnemyProjectileRocket") { prefabPools.CreateExplosion(transform, 0.27f); ship.PlayerTakeDamage(projectileDamage); gameManager.audioManager.PlaySound(6); } else if (projectileType == "EnemyProjectileAcid") { ship.ActivateAcid(5); //for (int curIcon = 0; curIcon < 2; curIcon++) //{ randRow = Random.Range(0, Board.GridRows); randColumn = Random.Range(0, Board.GridColumns); board.boardIcons[(randRow), (randColumn)].ActivateAcid(projectileDamage, 5); //} } else if (projectileType == "EnemyProjectileDrain") { if (normalProjectile) { prefabPools.CreateExplosion(transform, 0.22f); ship.PlayerTakeDamage(projectileDamage); } } else if (projectileType == "EnemyProjectileWeaken") { if (normalProjectile) { prefabPools.CreateExplosion(transform, 0.22f); ship.PlayerTakeDamage(projectileDamage); } } else if (projectileType == "EnemyProjectileFire") { randRow = Random.Range(0, Board.GridRows); randColumn = Random.Range(0, Board.GridColumns); for (int curRow = 0; curRow < 3; curRow++) { for (int curCol = 0; curCol < 3; curCol++) { int randomNumber = Random.Range(0, 3); if (randomNumber > 0) { board.boardIcons[(randRow + curRow) % Board.GridRows, (randColumn + curCol) % Board.GridColumns].ActivateFire(projectileDamage); } } } } if (normalProjectile) { PushOnStack(); } } else if (ship.CheckReflection() && normalProjectile) { if (projectileType == "EnemyProjectileRocket" || projectileType == "EnemyProjectileLaser" || projectileType == "EnemyProjectileFire" || projectileType == "EnemyProjectileAcid" || projectileType == "EnemyProjectileDrain" || projectileType == "EnemyProjectileWeaken") { SetReflected(); gameManager.missionTracker.IncrementMissionProgress(11, 1); } } else if (normalProjectile) { if ((projectileType == "EnemyProjectileRocket" || projectileType == "EnemyProjectileLaser" || projectileType == "EnemyProjectileFire" || projectileType == "EnemyProjectileAcid" || projectileType == "EnemyProjectileDrain" || projectileType == "EnemyProjectileWeaken") && normalProjectile) { SetRedirected(); } } } else if (collisionTag == "Enemy") { if (reflected) { if (projectileType == "EnemyProjectileLaser") { prefabPools.CreateExplosion(transform, 0.13f); objectCollision.GetComponent <Enemy>().EnemyTakeDamage(projectileDamage, 1.0f, false); } else if (projectileType == "EnemyProjectileRocket") { prefabPools.CreateExplosion(transform, 0.13f); objectCollision.GetComponent <Enemy>().EnemyTakeDamage(projectileDamage, 1.2f, false); } else if (projectileType == "EnemyProjectileAcid") { objectCollision.GetComponent <Enemy>().ActivateDamageOverTime(projectileDamage, 5, 0); } else if (projectileType == "EnemyProjectileFire") { objectCollision.GetComponent <Enemy>().ActivateDamageOverTime(projectileDamage, 5, 1); } else if (projectileType == "EnemyProjectileDrain") { prefabPools.CreateExplosion(transform, 0.2f); objectCollision.GetComponent <Enemy>().EnemyTakeDamage(projectileDamage, 1.2f, false); } else { prefabPools.CreateExplosion(transform, 0.2f); objectCollision.GetComponent <Enemy>().EnemyTakeDamage(projectileDamage, 1.2f, false); } PushOnStack(); } } else if (collisionTag == "ArmamentSecondary" && normalProjectile) { gameManager.missionTracker.IncrementMissionProgress(3, 1); gameManager.prefabPools.CreateExplosion(transform, 0.16f); PushOnStack(); } else if (collisionTag == "Asteroid") { if (projectileType == "EnemyProjectileLaser") { prefabPools.CreateExplosion(transform, 0.13f); objectCollision.GetComponent <Asteroid>().EnemyTakeDamage(projectileDamage, 0.0f); } else if (projectileType == "EnemyProjectileRocket") { prefabPools.CreateExplosion(transform, 0.13f); objectCollision.GetComponent <Asteroid>().EnemyTakeDamage(projectileDamage, 0.0f); } else if (projectileType == "EnemyProjectileAcid") { objectCollision.GetComponent <Asteroid>().ActivateDamageOverTime(projectileDamage, 5, 0); } else if (projectileType == "EnemyProjectileFire") { objectCollision.GetComponent <Asteroid>().ActivateDamageOverTime(projectileDamage, 5, 1); } else if (projectileType == "EnemyProjectileDrain") { prefabPools.CreateExplosion(transform, 0.2f); objectCollision.GetComponent <Asteroid>().EnemyTakeDamage(projectileDamage, 0.0f); } else { prefabPools.CreateExplosion(transform, 0.2f); objectCollision.GetComponent <Asteroid>().EnemyTakeDamage(projectileDamage, 0.0f); } PushOnStack(); } }