public override void OnAdvantage(GameObject collider, GameObject other) { Debug.Log("LASER ADVANTAGE"); isReflecting = false; // If this is a weapon spawn, destroy it. if (other.GetComponent <IWeaponSpawn>() != null) { Destroy(other); } // If this is a destructible, attempt to inflict damage. IDestructable destructable = other.GetComponent <IDestructable>(); if (destructable != null) { destructable.ReceiveDamage(DamageCalculator.CalculateByDistance(collider.transform.position, other.transform.position, damageMultiplier)); ParticleController.GetInstance().InstantiateParticle(ParticleController.PlayerLaserCollision, other.transform.position, transform.position); return; } // Finally, jam the laser if applicable. if (charge != null) { charge.Jam(); Debug.Log("LASER JAMMED"); } }
public void OnAdvantage(GameObject collider, GameObject other) { Debug.Log("BULLET ADVANTAGE"); // If this is a destructible, attempt to inflict damage. IDestructable destructable = other.GetComponent <IDestructable>(); if (destructable != null) { destructable.ReceiveDamage(DamageCalculator.CalculateByDistance(collider.transform.position, other.transform.position, origin.damageMultiplier)); OnTrigger(); return; } }
public void OnNeutral(GameObject collider, GameObject other) { Debug.Log("BULLET NEUTRAL:" + this.gameObject); // If this is a destructible, attempt to inflict damage. IDestructable destructable = other.GetComponent <IDestructable>(); if (destructable != null) { destructable.ReceiveDamage(DamageCalculator.CalculateByDistance(collider.transform.position, other.transform.position, origin.damageMultiplier)); OnTrigger(); return; } // Apply the new vector. Debug.Log("this velocity:" + currentVelocity); Debug.Log("other velocity:" + other.GetComponent <Rigidbody>().velocity); Rigidbody thisRigidbody = rigidBody; Rigidbody otherRigidbody = other.GetComponent <Rigidbody>(); Vector3 otherVelocity = otherRigidbody.velocity; Vector3 temp = new Vector3(currentVelocity.x, currentVelocity.y, currentVelocity.z); currentVelocity = new Vector3(otherVelocity.x, otherVelocity.y, otherVelocity.z); other.GetComponent <Rigidbody>().velocity = temp; rigidBody.MoveRotation(Quaternion.LookRotation(currentVelocity)); otherRigidbody.MoveRotation(Quaternion.LookRotation(other.GetComponent <Rigidbody>().velocity)); Debug.Log("this velocity now:" + currentVelocity); Debug.Log("other velocity now:" + other.GetComponent <Rigidbody>().velocity); //currentVelocity = colliderVelocity2 * multiplier; //ParticleController.GetInstance().InstantiateParticle(ParticleController.ProjectileBounce, transform.position); }