public override float RecieveHit(Ship sender, float damage) { if (invincible) return 0f; if (!enabled) return 0f; float damageToHealth = damage - shield; float damageDone = ChangeShield(-damage); if (damageToHealth > 0f) { damageDone += ChangeHealth(-damageToHealth); HitMat(HealthHit_Mat); } else { HitMat(shieldHitMat); AudioManager.Play(shieldHitClip); } if (health <= 0f) { Killed(sender); } return damageDone; }
public override void Initialize(Ship sender, float damage) { scale = new Vector3(myTransform.localScale.x, myTransform.localScale.y, 0f); myTransform.localScale = scale; gameObject.SetActive(true); base.Initialize(sender, damage); StartCoroutine(Fire()); }
public override void Initialize(Ship sender) { base.Initialize(sender); foreach (Weapon weapon in weapons) { weapon.Initialize(sender); } }
public void Initialize(Ship sender, float damage, float growTime, float explosionTime, float shrinkTime) { Initialize(sender, damage); shockwave.layer = gameObject.layer; // reset collider.enabled = true; shockwave.collider.enabled = true; StartCoroutine(Explode(growTime, explosionTime, shrinkTime)); }
/// <summary> /// Initialize all weapons. /// </summary> /// <param name="sender">Ship weapons are attached to.</param> /// <param name="damageStat">Ship's damage stat. Used to create the damage multiplier. 1+damageStat/100.</param> public void Initialize(Ship sender, float damageStat) { DamageMultiplier = 1 + damageStat / 100; for (int i = 0; i < weapons.Length; i++) { if (weapons[i] != null) { weapons[i].Initialize(sender); } } }
public void Initialize(Ship sender, float damage, float delay, float delaySpeed, float homingSpeed) { this.sender = sender; this.damage = damage; this.homingSpeed = homingSpeed; target = null; SetLayer(sender); collider.enabled = false; StartCoroutine(Delay(delay, delaySpeed)); }
public void Initialize(Ship sender, float damage, float speed, float angularSpeed, float homingTime, int dummyTargets, Transform target) { Initialize(sender, damage, Vector3.zero); this.speed = speed; this.angularSpeed = angularSpeed; this.homingTime = homingTime; this.dummyTargets = dummyTargets; this.target = target; GetComponent<Health>().Initialize(); StartCoroutine(Fire()); }
public override void Initialize(Ship sender, float damage, float time, Vector3 moveVec) { base.Initialize(sender, damage, moveVec); senderLayer = LayerMask.NameToLayer("PlayerShip"); gameObject.layer = LayerMask.NameToLayer("Default"); var health = (Health)GetComponent(typeof(Health)); health.Initialize(); health.HealthUpdateEvent += OnDeath; myTransform.localScale = Vector3.one; randomRotation = Random.rotation.eulerAngles; StartCoroutine(Grow(time)); }
public virtual void Initialize(Ship sender, float damage) { disabled = false; this.sender = sender; this.damage = damage; SetLayer(sender); hitCount = 0; }
public void Initialize(Ship sender, float damage, float time, float spreadSpeed) { Initialize(sender, damage, time); myTransform.localScale = Vector3.one; StartCoroutine(Spread(new Vector3(spreadSpeed, 0f, spreadSpeed))); }
public virtual void Initialize(Ship sender, float damage, float time, Vector3 moveVec) { Initialize(sender, damage, time); rigidbody.velocity = moveVec; }
/// <summary> /// Sets layer to PlayerWeapon or EnemyWeapon. /// </summary> /// <param name="sender">Ship that fired the weapon.</param> protected void SetLayer(Ship sender) { gameObject.layer = sender.CompareTag("Player") ? PlayerLayer : EnemyLayer; }
/// <summary> /// Recieve hit info from weapon. /// </summary> /// <param name="sender">Who shot the weapon.</param> /// <param name="damage">HitInfo from weapon.</param> public virtual float RecieveHit(Ship sender, float damage) { if (invincible) return 0f; float damageDone = ChangeHealth(-damage); if (health <= 0f) { Killed(sender); return damageDone; } if (HealthHit_Mat != null) { HitMat(HealthHit_Mat); } return damageDone; }
public virtual void Initialize(Ship sender, float damage, float time) { Initialize(sender, damage); myPoolObject.StartLifeTimer(time); }
public float RecieveHit(Ship sender, float damage, bool bypassShield) { if (!bypassShield) return RecieveHit(sender, damage); if (invincible) return 0f; float damageDone = ChangeHealth(-damage); HitMat(HealthHit_Mat); if (health <= 0f) { Killed(sender); } return damageDone; }
/// <summary> /// Call the DieEvent. /// </summary> /// <param name="sender">Ship that killed this ship. Null if trashed.</param> protected virtual void Killed(Ship sender) { DieEvent.Fire(this, new DieArgs(sender)); myRenderer.material = Normal_Mat; AudioManager.Play(deathClip); }
public override float RecieveHit(Ship sender, float damage) { return parent.RecieveHit(sender, damage); }
// <inherit/> public override void Initialize(Ship sender, float damage, Vector3 moveVec) { Initialize(sender, damage); speed = moveVec.magnitude; myRigidbody.velocity = Vector3.zero; }
public void Initialize(Ship sender, float damage, float disableTime, int id) { this.disableTime = disableTime; base.Initialize(sender, damage); StartCoroutine(Move(id)); }
public DieArgs(Ship killer) { this.killer = killer; }
public override void Initialize(Ship sender, float damage) { base.Initialize(sender, damage); StartCoroutine(Spin()); }
protected override void Killed(Ship sender) { if (rechargeJob != null) { rechargeJob.Kill(); } base.Killed(sender); }
public virtual void Initialize(Ship sender) { myTransform = transform; myShip = sender; power = FullPower; cooldownSpeed = FullPower / cooldownTime; }