private void Update()
{
rigidbody2D.velocity = new Vector2(speed, rigidbody2D.velocity.y);
if (leftPos != leftBttn.transform.position.y)
{
//rigidbody2D.velocity = new Vector2(speed, rigidbody2D.velocity.y);
speed = -5f;
}
else if (rightPos != rightBttn.transform.position.y)
{
speed = 5f;
}
else
{
speed = 0f;
}
rigidbody2D.velocity = new Vector2(speed, rigidbody2D.velocity.y);
}
private void OnCollisionEnter2D(Collision2D coll)
{
if (coll.gameObject.CompareTag("Shop") && gameObject.name == works.ci.ToString())
{
allVariables.money += 5;
works.howMuchEarn += 5;
works.textMoneyCourierEarn.text = "Заработано - " + works.howMuchEarn;
Destroy(gameObject);
}
}
[SerializeField]
private GameObject card; // твоя карта
public void BuyACard()
{
card.SetActive(true);
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class DND : MonoBehaviour, IBeginDragHandler, IDragHandler
{
public Transform transform;
public Vector2 vector2;
private void Awake()
{
transform = GetComponent<Transform>();
}
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("OnBeginDrag");
}
public void OnDrag(PointerEventData eventData)
{
Debug.Log("OnDrag");
vector2 = Camera.main.ScreenToWorldPoint(eventData.position);
transform.position = new Vector3(vector2.x, vector2.y, 0);
//transform.position = eventData.pointerCurrentRaycast.screenPosition;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class TapMoving : MonoBehaviour
{
public Camera cam;
public Variables variables;
public Vector2 vector2;
public Vector2 playerVector;
public GameObject objectThis;
public void Tap(InputAction.CallbackContext context)
{
Debug.Log(Mouse.current.position.x.ReadValue());
objectThis.transform.position = cam.ScreenToWorldPoint (new Vector3(Mouse.current.position.x.ReadValue(), Mouse.current.position.y.ReadValue(), 1));
}
public int inWordCount;
public int numberInArray = 0;
public int[] wordsCount;
public GameObject[] Letters;
public GameObject[] TakeLetters;
public bool[] IsLetterActive;
private void Start()
{
for (int i = 0; i < IsLetterActive.Length; i++)
{
IsLetterActive[i] = false;
}
}
private void OnTriggerEnter2D(Collider2D col)
{
if (TakeLetters[numberInArray] == null)
{
TakeLetters[numberInArray] = col.gameObject;
}
else
{
while (TakeLetters[numberInArray] != null)
{
numberInArray++;
if (TakeLetters[numberInArray] == null)
{
TakeLetters[numberInArray] = col.gameObject;
}
}
}
if (numberInArray < Letters.Length)
{
numberInArray++;
}
}
private void OnPress(InputValue value)
{
if (value.isPressed)
{
}
else
{
for (int inNumber = 0; inNumber < wordsCount.Length; inNumber++)
{
for (int InLetters = 0; InLetters < TakeLetters.Length; InLetters++)
{
inWordCount = wordsCount[inNumber];
while (inWordCount <= 0)
{
if (TakeLetters[InLetters])
{
}
}
}
}
}
}