// Use this for initialization void Start() { flameTransform = GameObject.Find("GrabberFlame").transform; cachedX = gameObject.GetComponentInChildren <Transform>().localScale.x; render = GameObject.Find("Staff").GetComponent <Renderer> (); grabberRender = GameObject.FindGameObjectWithTag("Grabber").GetComponent <Renderer>(); grabberRigid2d = GameObject.FindGameObjectWithTag("Grabber").GetComponent <Rigidbody2D>(); grabberTransform = GameObject.FindGameObjectWithTag("Grabber").transform; kanjiManagerScript = GameObject.Find("KanjiManager").GetComponent <KanjiManager>(); fairyFlyScript = GameObject.FindGameObjectWithTag("FairyFly").GetComponent <FairyFly>(); }
// Use this for initialization void Start() { kanjiManagerScript = GameObject.Find("KanjiManager").GetComponent <KanjiManager>(); cachedY = transform.position.y; grabber = GameObject.FindGameObjectWithTag("Grabber"); if (grabber != null) { grabberBoxCol = grabber.GetComponent <BoxCollider2D>(); } ropeScript = GameObject.Find("Hand_L").GetComponent <Rope>(); }
void Start() { KanjiManager.Init(); //IMPORTANT KanjiWriter = gameObject.AddComponent <WriterManager>(); KanjiWriter.TargetCamera = TargetCamera; KanjiWriter.TrailPrefab = TrailPrefab; KanjiWriter.AddOnWinPerfectEvent(new OnWinPerfect(WinPerfectEvent)); KanjiWriter.AddOnWinAlmostEvent(new OnWinAlmost(WinAlmostEvent)); KanjiWriter.AddOnWinPoorEvent(new OnWinPoor(WinPoorEvent)); KanjiWriter.AddOnNewKanjiEvent(new OnNewKanji(NewKanjiEvent)); KanjiWriter.NewKanji(); }
public void ParseKanji(string userstrokeCount, string path) { if (path == "") { return; } string results = ""; Kanji firstResult = null; foreach (Kanji kanji in KanjiManager.GetMatchingKanji(path)) { if (firstResult == null) { firstResult = kanji; results += kanji.Name; } else { results += kanji.Name;// + " " + kanji.Meaning; } } if (IsDebug) { DebugString = results; } if (path == SeekingKanji.Strokes) { OnWinPerfect?.Invoke(); } else { List <string> diff; string[] set1 = Regex.Matches(path, @"\(.+?(?=\))+.").Cast <Match>().Select(match => match.Value).ToArray(); string[] set2 = Regex.Matches(SeekingKanji.Strokes, @"\(.+?(?=\))+.").Cast <Match>().Select(match => match.Value).ToArray(); if (set1.Count() > set2.Count()) { diff = getDifferences(set1, set2); } else { diff = getDifferences(set2, set1); } if (diff.Count == 0 && userstrokeCount == SeekingKanji.strokeCount) { OnWinAlmost?.Invoke(); return; } if (set2.Count() > set1.Count()) { diff = set2.Except(set1).ToList(); } else { diff = set1.Except(set2).ToList(); } List <string> diffCopy = diff; for (int i = 0; i < diffCopy.Count; i++) { if (diffCopy[i].Replace("-", "") == "(0.5, 0.5)") { diff.RemoveAt(i); } } if (diff.Count == 0 && userstrokeCount == SeekingKanji.strokeCount) { OnWinPoor?.Invoke(); } else if (IsDebug) { string res = ""; foreach (var item in diff) { res += item; } if (res != "") { Debug.Log(res); } } } }
void Awake() { KanjiManager.Init(); WriterRef = GetComponent <Writer>() ?? gameObject.AddComponent <Writer>(); WriterRef.writerManager = this; }
public void NewKanji() { SetKanji(KanjiManager.GetRandomKanji()); }