Ejemplo n.º 1
0
 /// <summary>
 ///   Removes all child nodes from the _projectileShooterHolder node.
 /// </summary>
 private void UnequipProjectileShooters()
 {
     foreach (Node child in _projectileShooterHolder.GetChildren())
     {
         _projectileShooterHolder.RemoveChild(child);
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Throw the grenade
    /// </summary>
    /// <param name="elapsedTime">Elapsed time between the pression and the release of the button</param>
    public override void Shoot(int elapsedTime)
    {
        Vector2 direction = GetMouseDirection();

        this.Load();

        grenadeHolder.RemoveChild(WeaponAmmo);
        GetTree().GetRoot().AddChild(WeaponAmmo);
        WeaponAmmo.SetGlobalPosition(grenadeHolder.GlobalPosition);

        Grenade grenade = WeaponAmmo as Grenade;

        grenade.Launch(direction, elapsedTime * STRENGTH_FACTOR);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Shoot the ammo
    /// </summary>
    /// <param name="elapsedTime">Time elasped between the pression and the release of the button</param>
    public override void Shoot(int elapsedTime)
    {
        Vector2 direction = GetMouseDirection();

        this.Load();

        rifleHolder.RemoveChild(WeaponAmmo);
        GetTree().GetRoot().AddChild(WeaponAmmo);
        WeaponAmmo.SetGlobalPosition(rifleHolder.GlobalPosition);

        RifleAmmo rifleAmmo = WeaponAmmo as RifleAmmo;

        rifleAmmo.Launch(direction, STRENGTH_FACTOR);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Shoot the rocket
    /// </summary>
    /// <param name="elapsedTime">Elapsed time between the pression and the release of the button</param>
    public override void Shoot(int elapsedTime)
    {
        Vector2 direction = GetMouseDirection();

        this.Load();

        // Remove the rocket from the launcher and set it in the scene as a child of root
        rocketHolder.RemoveChild(WeaponAmmo);
        GetTree().GetRoot().AddChild(WeaponAmmo);
        WeaponAmmo.SetGlobalPosition(rocketHolder.GlobalPosition);

        // Launch the rocket (apply force)
        Rocket rocket = WeaponAmmo as Rocket;

        rocket.Launch(direction, elapsedTime * STRENGTH_FACTOR);
    }