Exemple #1
0
    public static void projectile(Actor cardUser, float distanceFromUser, ProjectileBase preInstateatedProjectile)
    {
        Vector2 userPosition      = cardUser.get2dPostion();    //this can be changed to a muzzle location
        Vector2 aimVectorFromUser = cardUser.getNormalizedAim(userPosition);

        //setting projectile properties
        ProjectileBase projectile = preInstateatedProjectile;

        projectile.transform.position = userPosition + aimVectorFromUser * distanceFromUser;         //start projectile a little ways off of the user
        projectile.setVolocity(aimVectorFromUser * getProjectileSpeed(cardUser, preInstateatedProjectile.getBaseSpeed()));
        //set the damage of the projectile
        projectile.setDamage(getProjectileDamage(cardUser, preInstateatedProjectile.getBaseDamage(), preInstateatedProjectile.getDamageType()), preInstateatedProjectile.getDamageType(), cardUser.Team);
        projectile.setIgnoredColliders(new Collider2D[] { cardUser.collider });
    }