public override bool applyEffect(Buffable target) { //Attempt to get a reference to the ProjectileHandler of the object we're giving the energy to ProjectileHandler handler = target.GetComponent <ProjectileHandler>(); //If handler exists, add energyBonus to its energy pool if (handler) { handler.energy += energyBonus; return(true); } else { return(false); } }
public override bool applyEffect(Buffable target) { //The target of this effect is a BombController buffTarget = target.GetComponent <BombController>(); //Set the BombController's (not RigidBody2D) gravity to 0 //Return false if the given object doesn't have a BombController if (buffTarget) { storedGravity = buffTarget.gravity; buffTarget.gravity = 0; applied = true; return(true); } else { return(false); } }