using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Walker : MonoBehaviour
{
private Rigidbody2D rb;
public float speed = 1.5f;
private Vector2 moveVector;
public float jumpForce = 5.0f;
void Awake()
{
rb = GetComponent<Rigidbody2D>();
}
private void Update()
{
moveVector = transform.right * Input.GetAxis("Horizontal") * speed;
if (Input.GetKeyDown(KeyCode.Space))Jump();
}
void FixedUpdate()
{
if(moveVector.x!=0f)MoveCharacter();
}
void MoveCharacter()
{
moveVector.y=rb.velocity.y;
rb.velocity = moveVector;
}
void Jump()
{
rb.AddForce(transform.up*jumpForce, ForceMode2D.Impulse);
}
}
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 одинаковы по типу
сделай скрин через Shift + Win + S