示例#1
0
文件: AIPlayer.cs 项目: lipusal/VJI
    private void HitBall()
    {
        BallLogic ball        = BallLogic.Instance;
        Vector3   aimPosition = _AIStrategy.GeneratePositionBasedOnDifficulty(difficulty);
        Vector3   velocity    = BallLogic.Instance.GetVelocity(aimPosition, _timeToBounce);//change time in function of currentHitForce

        AudioManager.Instance.PlaySound(ball.transform.position, (int)SoundId.SOUND_HIT);
        ball.GetComponent <Rigidbody>().velocity = velocity;
        ball.SetHittingPlayer(_id);
        _newPosition = true;
    }
示例#2
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);
    }
示例#3
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);
    }