public virtual void sAbility() { Vector2 SpawnPosition = transform.position; //Debug.Log ("Using"); Vector2 Direction = CalcTrajectory(); if (float.IsNaN(Direction.x)) { enemyStats.setInRange(false); return; } enemyStats.setInRange(true); //TODO add targeting and spawn the bullet GameObject Bullet = GameObject.Instantiate(projectile); Bullet.GetComponent <Projectile>().sourceObj = this.gameObject; Bullet.GetComponent <Projectile> ().hurtPlayer = true; Bullet.GetComponent <Transform>().position = SpawnPosition; Bullet.GetComponent <Rigidbody2D>().AddForce(Bullet.GetComponent <Rigidbody2D>().mass *Direction, ForceMode2D.Impulse); }