if(Vector3.Distance(_platform.transform.position,targetPos)>0.1f)
if (reversed) pos -= Time.deltaTime * distance;
else pos += Time.deltaTime * distance;
if ((pos < 1f) && (pos > 0f))
{
_platform.transform.position = Vector3.Lerp(startPoint.position, endPoint.position, pos);
}
else _canMove = false;
direction.Set(Input.GetAxis("Horizontal) * speed,rb.velocity.y,Input.GetAxis("Vertical") * speed);
rb.velocity=direction;
Vector3 movementVector = transform.forward * movementInput.y * CurrentSpeed + transform.right * movementInput.x * CurrentSpeed;
if (IsGrounded) RB.velocity = Vector3.Lerp(RB.velocity, movementVector, Config.MovementBlendRate);
else if (Config.AirControl)
{
movementVector.y = RB.velocity.y;
RB.velocity = Vector3.Lerp(RB.velocity, movementVector, Config.MovementBlendRate);
}
Skins skins;
GameObject Store;
Store = GameObject.FindGameObjectWithTag("MainCamera");
skins = Store.GetComponent<Skins>();
Skins skins = Camera.main.GetComponent<Skins>();
Skins skins = Camera.main.GetComponent<Skins>();
if(skins==null )Debug.log("initialization of the bug");
Debug.Log(YandexGame.savesData.sand);
Debug.Log(skins.Sand);
YandexGame.savesData.sand is int ?Debug.Log("Ok"):Debug.Log(" Not INT"); тут за место инта должно долно быть skins.Sand не уверен что верно написал, надо проверить что YandexGame.savesData.sand и skins.Sand одинаковы по типу
///===///
GameObject Decal = Instantiate(GetGO(), hit.point + (hit.normal * .01f));
Decal.transform.SetParent(null); //под вопросом
///===///
GameObject GetGO()
{
return transform.GetChild(0).gameObject;
}
if (Input.GetMouseButtonDown(0))
{
Ray ray = _camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit))
{
if(hit.transform.gameObject.TryGetComponent(out EnemyCode enemy))
{
enemy.hit();
}
else
{
if (shootPF == null) Debug.LogError("Instance Bug");
GameObject Decal=Instantiate(shootPF,hit.point + (hit.normal * .01f));
Decal.transform.forward = -hit.normal;
Decal.transform.SetParent(hit.transform);
}
}
}
И да будет правильнее использовать SerializeField но вопрос не в этом)