Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- public class Run : MonoBehaviour {
- private Rigidbody2D rb2d;
- public int startSpeed;
- private string pressedKey;
- // Use this for initialization
- void Start () {
- rb2d = GetComponent<Rigidbody2D>();
- }
- void CheckSequence()
- {
- Debug.Log(pressedKey);
- if(pressedKey.Contains("AA") || pressedKey.Contains("DD"))
- {
- Debug.Log("АТАС!");
- pressedKey = "";
- }
- }
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.D))
- {
- pressedKey += "D";
- CheckSequence();
- }
- else if (Input.GetKeyDown(KeyCode.A))
- {
- pressedKey += "A";
- CheckSequence();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement