public override void TakeDamage(float damage, int otherId, int otherTeam) { //RedSprite (); if (health <= 0f) { return; } if (playerTag.Id == otherId) { return; } if (otherTeam != 0 && playerTag.Team == otherTeam) { return; } if (invincibilty) { return; } if (armor > 0f) { if (armor > .99f) { armor = .90f; } else { armor -= damage * .005f; } if (armor < 0f) { armor = 0f; } damage *= 1f - armor; } health -= damage; playerUI.UpdateHealthUI(health, armor); //StartCoroutine (InvincibilityRoutine(30f)); //FX NumberSpawner.Instance.CreateNumber(transform.position, Mathf.Round(damage).ToString(), numCol, .1f, 120f, 3f); GetComponentInChildren <AudioManager> ().Play(1); GetComponentInChildren <ParticleController> ().Play(3); if (health <= 0f) { Die(otherId); } else { killFlag = KILL_FLAGS.NONE; } }
public override void Die(int otherId) { // This behaviour contains player-specific behaviours -- needs to be refactored lives--; if (otherId == -1) { killFlag = KILL_FLAGS.SELF; } KillFlagNoise(); GetComponent <PlayerEnemyHandler> ().Disband(); // DIE Instantiate(diePrefab, transform.position, Quaternion.identity); GlobalAudioManager.Instance.PlayDeath(); GetComponent <Base_PowerupManager> ().Reset(); StopAllCoroutines(); stunStack = 0; // NEW FUNCTION? Base_Bullet[] bullets = GetComponentsInChildren <Base_Bullet> (); // Remove all bullets for (int i = 0; i < bullets.Length; i++) { Destroy(bullets [i].gameObject); } GameObject killer = GameManager.Instance.GetPlayer(otherId); // Spawn Number if (otherId != playerTag.Id && otherId > -1) { if (killer != null) { NumberSpawner.Instance.CreateNumber(killer.transform.position, "+10% Damage", NUMBER_COL.RED, .05f, 60f, 1f); killer.GetComponent <Base_WeaponManager> ().DamageMult += .1f; } if (GameManager.gameMode == GAMEMODE.PVP) // GameMode Reactions //ChildQueueController.player_profiles [playerTag.Id-1].deaths++; //ChildQueueController.player_profiles [otherId-1].kills++; //GameManager.Instance.playerKills [otherId-1]++; { } else if (GameManager.gameMode == GAMEMODE.JUGGERNAUT) { /* * lives = Mathf.Max (lives, 1); * GameManager.Instance.juggernautPoints [otherId-1]++; * if (movementScript.isJuggernaut) { * killer.GetComponent<MovementScript> ().BecomeJuggernaut(); * movementScript.UnbecomeJuggernaut (); * } */ } else if (GameManager.gameMode == GAMEMODE.PVE) { GameManager.Instance.enemyMult = Mathf.Floor(GameManager.Instance.enemyMult / .5f); GameManager.Instance.enemyMult *= .5f; } } if (lives > 0) { GameManager.Instance.StartCoroutine(GameManager.Instance.RespawnPlayer(gameObject)); } else { //ChildQueueController.player_profiles [playerTag.Id].losses++; } gameObject.SetActive(false); // FINAL LINE }
public override void SetKillFlag(KILL_FLAGS killFlag) { this.killFlag = killFlag; }
public virtual void SetKillFlag(KILL_FLAGS killFlag) { }