примерно, когда я пытаюсь
x * 1.05, получается x * 1х*1,1, выходит х*1,05
Код: Выделить всё
using System;
public class Example
{
public static void Main()
{
int gainAmount = 20;
float _gainAmountModifier = 1.05f
gainAmount = (int)(gainAmount * _gainAmountModifier);
Debug.Log(_gainAmountModifier);
Debug.Log(gainAmount);
}
}
// The example displays output like the following:
// 1.05
// 20
Код: Выделить всё
using System;
public class Example
{
public static void Main()
{
int var_int = 100;
float var_f = var_int;
var_f = var_f * 1.05f;
var_int = (int)var_f;
Console.WriteLine(var_f);
Console.Write(var_int);
}
}
// The example displays output like the following:
// 105
// 104
Подробнее здесь: https://stackoverflow.com/questions/784 ... m-in-unity
Мобильная версия