Ejemplo n.º 1
0
    /// <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);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the LoadedProjectile assosciated with this instance of prjectile.
 /// </summary>
 /// <param name="loaded"></param>
 public void SetLoadedProjectile(LoadedProjectile loaded)
 {
     LoadedProjectile = loaded;
 }
Ejemplo n.º 3
0
 public void DestroyProjectile(LoadedProjectile proj)
 {
     LoadedProjectiles.Remove(proj);
     Destroy(proj.gameObject);
 }