示例#1
0
    public void Rotate(float distance, float angleY)
    {
        var        angleForCalculateToSpeed = _linerDistanceToAngleConverter.StraightPointCalculation(distance, minDistance, maxDistance);
        var        angleCannon    = _linerAngleToAngleConverter.StraightPointCalculation(angleForCalculateToSpeed);
        Quaternion toAngle        = Quaternion.Euler(0, 0, angleForCalculateToSpeed);
        Quaternion newCannonAngle = Quaternion.Euler(0, angleCannon, 0);

        transform.rotation             = Quaternion.Euler(0, angleY, transform.eulerAngles.z);
        transform.rotation             = Quaternion.Slerp(transform.rotation, toAngle, Time.deltaTime * speedRotate);
        cannonCartBarrel.localRotation = Quaternion.Slerp(cannonCartBarrel.localRotation, newCannonAngle, Time.deltaTime * speedRotate);
        _trajectory.Draw(_trajectory.CalculatePoints(transform.up * CalculateVelocity(firingPoint)));
    }