float jumpStartRotation = 0;
private void Jump()
{
if (Input.GetMouseButtonDown(0) && _isGrounded)
{
rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, JumpForce);
jumpStartRotation = transform.rotation.z;
}
}
...if(!_isGrounded)
{
float deltaAngle = Math.Clamp(x * deltaTime, 0, jumpStartRotation + 90); //чтобы не более 90 град
transform.rotation.z = jumpStartRotation + deltaAngle;
}
public static void Main()
{
Console.Write("Введите первую тригонометрическую функцию (sin, cos, tan, cot): ");
string trig1 = Console.ReadLine();
Console.Write("Введите значение угла: ");
int degree1 = int.Parse(Console.ReadLine());
Console.WriteLine();
Console.Write("Введите вторую тригонометрическую функцию (sin, cos, tan, cot): ");
string trig2 = Console.ReadLine();
Console.Write("Введите значение угла: ");
int degree2 = int.Parse(Console.ReadLine());
var trigValue1 = GetTrigValue(trig1, degree1);
var trigValue2 = GetTrigValue(trig2, degree2);
Calc(trigValue1, trigValue2);
}
private static double GetTrigValue(string trigFunc, int degree){
switch(trigFunc){
case "sin": return Math.Sin(degree);
case "cos": return Math.Cos(degree);
case "tan": return Math.Tan(degree);
case "cot": return Math.Cot(degree);
default: return 0.0d;
}
}
private static void Calc(double val1, double val2){
Console.Write($"{val1} - {val2} = {val1 - val2}");
Console.Write($"{val1} + {val2} = {val1 + val2}");
...
}
int[] sum = new int[5];
int max = Int32.MinValue;
int maxColumnIndex = 0;
for (int k = 0; k < dataGridView1.Rows.Count; ++k)
{
for(int j = 0; j < dataGridView1.Rows[k].Cells.Count; j++)
{
var colSum = sum[j] + Convert.ToInt32(dataGridView1.Rows[k].Cells[j].Value);
sum[j] = colSum;
if(colSum > max){
max = colSum;
maxColumnIndex = j;
}
}
}
label1.Text = maxColumnIndex.ToString();
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Pen pen = new System.Drawing.Pen(System.Drawing.Color.Red, 2);
e.Graphics.DrawLine(pen, 0, 0, 150, 150);
pen.Dispose();
}