/// <summary> /// Spawns a new projectile in the current world/subworld at the given /// position and direction /// </summary> /// <param name="position"></param> /// <param name="direction"></param> /// <param name="projectile"></param> public void AddNewProjectile(Vector3 position, Vector2 direction, Projectile projectile, Entity source = null, float yAxisRotate = 0) { Debug.Log("Projectile added"); GameObject pro = Instantiate(projectile.GenerateProjectileObject()); pro.transform.Rotate(new Vector3(0, yAxisRotate, 0)); pro.transform.parent = transform; LoadedProjectile l = pro.AddComponent <LoadedProjectile>(); l.CreateProjectile(position, direction, projectile, source); if (source != null) { } LoadedProjectiles.Add(l); }
/// <summary> /// Sets the LoadedProjectile assosciated with this instance of prjectile. /// </summary> /// <param name="loaded"></param> public void SetLoadedProjectile(LoadedProjectile loaded) { LoadedProjectile = loaded; }
public void DestroyProjectile(LoadedProjectile proj) { LoadedProjectiles.Remove(proj); Destroy(proj.gameObject); }