Unity 2D реализация прыжка, работа с условиями и массивами
Я хочу, чтобы динозавр в моей игре прыгал, когда введено нужное слово из массива + Enter, есть скрипт, но в неё динозавр просто прыгает, не проходя это условие и ничего не делая с ним, помогите, пожалуйста, вот код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour
{
public InputField InputField;
public Text TEXT;
public float speed;
private float moveInput;
private Rigidbody2D rb;
public bool faceRight = true;
public Text word;
public InputField InputField;
public static string myfunc()
{
Random rnd = new Random();
string[] arr = {"Даня ","Глеб ","Сеня "};
return arr[rnd.Next(2)];
}
public float Jumpforce;
private bool isGround;
public Transform groundCheak;
private int ExtraJump;
public int extraJumpValue;
public float cheakRadius;
public LayerMask WhatIsGround;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
if(isGround == true)
{
ExtraJump = extraJumpValue;
}
if(Input.GetKeyDown(KeyCode.Space) && ExtraJump > 0)
{
rb.velocity = Vector2.up * Jumpforce;
ExtraJump--;
}
else if (Input.GetKeyDown(KeyCode.Space) && ExtraJump == 0 && isGround == true && Random rnd == word.text)
{
rb.velocity = Vector2.up * Jumpforce;
}
}
void FixedUpdate()
{
text.text = $"{Massiv[Random.Range(0, 3)]}";
}
private void FixedUpdate()
{
isGround = Physics2D.OverlapCircle(groundCheak.position, cheakRadius, WhatIsGround);
moveInput = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
}
public void Reset()
{
if (TEXT.text = )
}
}