protected Projectile LaunchProjectile(Vector2 startPoint, Vector2 direction) { Projectile projectile = projectileFactory.GetProjectile(projectileType); projectile.transform.position = startPoint; projectile.LaunchProjectile(owner, direction, damage, projectilesSpeed); return(projectile); }
public void Attack(Rigidbody2D body, int damage, Vector2 direction) { ProjectileFactory fac = new ProjectileFactory(); GameObject proj = Object.Instantiate(fac.GetProjectile(EnemyType.Demon).GetProjectilePrefab(), body.position, new Quaternion()); proj.GetComponent <Rigidbody2D>().velocity = direction * proj.GetComponent <Projectile>().speed; proj.GetComponent <Rigidbody2D>().rotation = 0; body.velocity = Vector2.zero; //proj.GetComponent<Projectile>().damage = damage; //yield return new WaitForSeconds(1f); }