예제 #1
0
파일: AIPlayer.cs 프로젝트: lipusal/VJI
    public void Serve()
    {
        Vector3   currentPosition = transform.position;
        BallLogic ball            = BallLogic.Instance;

        ball.AppearBall(new Vector3(currentPosition.x + 0.1f, 4.05f, currentPosition.z), Vector3.zero);
        Vector3 ballVelocity = ball.GetVelocity(_serveTarget, 1.5f);

        ball.GetComponent <Rigidbody>().velocity = ballVelocity;
        BallLogic.Instance.SetHittingPlayer(_id);
        Destroy(_animatedServingBall);
    }
예제 #2
0
파일: PlayerLogic.cs 프로젝트: lipusal/VJI
    private void Serve()
    {
        Vector3   currentPosition = transform.position;
        BallLogic ball            = BallLogic.Instance;

        ball.AppearBall(new Vector3(currentPosition.x + 0.1f, 4.05f, currentPosition.z), Vector3.zero);
        float   minTime  = GetServeMinTime();
        float   maxTime  = GetServeMaxTime();
        float   time     = GetTimeToBounce(minTime, maxTime);
        Vector3 velocity = BallLogic.Instance.GetVelocity(aimTarget.position, time);

        ball.GetComponent <Rigidbody>().velocity = velocity;
        BallLogic.Instance.SetHittingPlayer(_id);
        Destroy(_animatedServingBall);
    }