Beispiel #1
0
        private void ShootBall(Collision collision)
        {
            Vector3 launchDirection = (baseLaunchDirection.normalized + (collision.collider.transform.position - transform.position).normalized * relativeDirectionFactor).normalized;
            Vector3 launchVelocity  = launchDirection * power;

            scoreObstacle.Hit();
            collision.collider.attachedRigidbody.velocity = launchVelocity;
        }
Beispiel #2
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.layer == LayerMask.NameToLayer("Ball"))
            {
                Vector3 launchDirection = (other.transform.position - transform.position).normalized;
                Vector3 launchVelocity  = launchDirection * power;

                scoreObstacle.Hit();
                other.attachedRigidbody.velocity = launchVelocity;
            }
        }
Beispiel #3
0
    public void OnTriggerEnter(Collider other)
    {
        var ball = other.GetComponent <Ball>();

        if (ball != null)
        {
            scoreObstacle.Hit();
            vacumedBall = other.gameObject;
            StartCoroutine(KeepBal());
        }
    }
Beispiel #4
0
    public void OnTriggerEnter(Collider other)
    {
        var ball = other.GetComponent <Ball>();

        if (ball != null)
        {
            scoreObstacle.Hit();
            teleportingBall = other.gameObject;
            velocity        = other.gameObject.GetComponent <Collider>().attachedRigidbody.velocity;
            teleportingBall.GetComponent <Collider>().attachedRigidbody.velocity = new Vector3();
            teleportingBall.SetActive(false);
            audioController.Teleport();
            StartCoroutine(StartTeleport());
        }
    }