示例#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
    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);
    }