Exemple #1
0
    public override void Animate(float newState)
    {
        if (Math.Abs(newState) < TOLERANCE)
        {
            return;
        }
        newState *= invert ? -1 : 1;
        var newAngle = startAngle + newState * step;
        var curAngle = transform.localRotation.eulerAngles;

        curAngle[(int)(1 - rotateType)] += newAngle;
        if (rotateType == RotateType.Elevation)
        {
            curAngle[(int)(1 - rotateType)] =
                Mathf.Clamp(AngleUtils.NormalizeAngle180(curAngle[(int)(1 - rotateType)]), -pMaxHAngle, -pMinHAngle);
        }
        transform.localRotation = Quaternion.Euler(curAngle);
    }
Exemple #2
0
 private float GetElevation(float potential) =>
 AngleUtils.NormalizeAngle180(potential * Time.deltaTime * 360 / (BASE_V_SPEED * speed));