I am trying to make a list of greetings. All of them work as intended except for “hello”. I have moved it around but i still get no match. I do not know what is going on.`
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class SARAH : MonoBehaviour {
int tgt = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void Processtags(List<string> tags)
{
List<string> greetingoffencenoun = new List<string>();
greetingoffencenoun.Add("greeting");
greetingoffencenoun.Add("offencenoun");
if (tags.SequenceEqual(greetingoffencenoun))
{
print("we haz a mach!!");
}
}
public void GetText(string text)
{
string[] greetingz = new string[]{ "hi", "hello", "howdy", "ello" };
string[] offencenouns = new string[]{ "idiot", "moron", "simpleton", "egghead" };
tgt = 0;
List<string> tags = new List<string>();
foreach (string x in greetingz)
{
if (text.Contains(x))
{
tags.Add("greeting");
tgt += 1;
//print(greetings[UnityEngine.Random.Range(0, greetings.Length)]);
}
}
foreach (string x in offencenouns)
{
if (text.Contains(x))
{
tags.Add("offencenoun");
tgt += 1;
}
}
if (tgt == 2)
{
Processtags(tags);
}
}
}
`