public void OnInstantiateAbility(InstantiatedAbility instantiatedAbility) { Rigidbody rigidbody = instantiatedAbility.GetComponent <Rigidbody>(); if (!rigidbody) { return; } rigidbody.velocity = (this.transform.forward + this.addedDirection).normalized * this.speed * this.GetCastTimeMultiplier(); }
public void OnInstantiateAbility(InstantiatedAbility instantiatedAbility) { Rigidbody rigidbody = instantiatedAbility.GetComponent <Rigidbody>(); if (!rigidbody) { return; } Vector3 impulseVector = (this.transform.forward + this.addedDirection).normalized * this.impulse * this.GetCastTimeMultiplier(); rigidbody.AddForce(impulseVector); if (this.recoilEffect != 0f) { this.playerCastInstantiateAbility.abilityManager.player.GetRigidbody().AddForce(impulseVector * -1f * this.recoilEffect); } }