Exemplo n.º 1
0
        public void Shoot()
        {
            this.ball.transform.localPosition = this.transform.localPosition;
            this.ball.gameObject.SetActive(true);
            this.ball.GetComponent <Collider>().AddForce(this.transform.localScale);

            Sound.Play(this.clip);
            ViceCamera.Shake(this.shakingValue);
            Vibrate.Do(VIBRATE_TIME);
        }
Exemplo n.º 2
0
        private void OnCollide(Collider collider, Vector3 point)
        {
            var ball = collider.GetComponent <Ball>();

            if (ball != null)
            {
                ball.Rebound(point, this.CheckedFunc);

                float valueX = Math.Lerp(POWER_X.x, POWER_X.y, Math.Random());
                float valueZ = Math.Lerp(POWER_Z.x, POWER_Z.y, Math.Random());

                var velocity = Ball.Velocity;
                velocity.x    = velocity.x * (ACCELERATION_RATE / Mathf.Abs(velocity.x)).ToFixed();
                velocity.x   += valueX * this.direction * Judge.Rate;
                velocity.z    = valueZ * Judge.Rate;
                Ball.Velocity = velocity;
                this.shaking.Collide();

                if (this.isPlayer)
                {
                    Vibrate.Do((int)(velocity.magnitude * 10));
                }
            }
        }