Ejemplo n.º 1
0
    public void hit(Bullet bullet, Vector3 position, Vector3 direction)
    {
        if (bullet.shooter is Player)
        {
            Player other = bullet.shooter as Player;
            if (other.index != index)
            {
                Vector2 force = (Vector2)direction * 5.0f;
                playerController.addForce(force);

                customParticleEmitter.hit(other.color, position, -direction);

                PoolManager.instance.destroyInstance(bullet.GetComponent <PoolInstance>());
                GameCamera.instance.shake(0.25f, 0.25f);
            }
        }
        else if (bullet.shooter is IEnemy && !isInvulnerable)
        {
            kill();
            customParticleEmitter.hit(color, position, -direction);

            PoolManager.instance.destroyInstance(bullet.GetComponent <PoolInstance>());
            GameCamera.instance.shake(0.25f, 0.25f);
        }
    }
Ejemplo n.º 2
0
    public void hit(Bullet bullet, Vector3 position, Vector3 direction)
    {
        if (bullet.shooter is Player)
        {
            Player other = bullet.shooter as Player;
            other.addScore(score);

            customParticleEmitter.hit(other.color, position, -direction);

            //Destroy the ship and the bullet
            PoolManager.instance.destroyInstance(GetComponent <PoolInstance>());
            PoolManager.instance.destroyInstance(bullet.GetComponent <PoolInstance>());

            GameCamera.instance.shake(0.25f, 0.25f);
        }
    }