Exemplo n.º 1
0
    public void Fly(Quaternion rotation, float impulseForce,
                    BallMaterial ballMaterial, BallLayer ballLayer, bool trail = true)
    {
        if (_rb2D.bodyType == RigidbodyType2D.Static)
        {
            SetRigidbodyType(RigidbodyType2D.Dynamic);
        }
        SetColliderMaterial(ballMaterial);
        SetLayer(ballLayer);
        ActiveTrail(trail);

        this.gameObject.transform.rotation = rotation;

        _rb2D.AddForce(this.transform.up * impulseForce, ForceMode2D.Impulse);
    }
Exemplo n.º 2
0
    private void SetLayer(BallLayer ballLayer)
    {
        switch (ballLayer)
        {
        case BallLayer.Solid:
            this.gameObject.layer = LayerMask.NameToLayer("SolidBall");
            break;

        case BallLayer.Flying:
            this.gameObject.layer = LayerMask.NameToLayer("FlyingBall");
            break;

        default:
            break;
        }
    }