Example #1
0
 Transform GetGrabbedWordPos()
 {
     foreach (GameObject go in wordList2)
     {
         if (go != null)
         {
             kanjiWordScript = go.GetComponent <KanjiWord>();
             if (kanjiWordScript.grabbed)
             {
                 return(kanjiWordScript.gameObject.transform);
             }
         }
     }
     return(null);
 }
Example #2
0
        private void generateKanjiWord()
        {
            if (debug)
            {
                Console.WriteLine("Kanji List Length: " + kanji.getLength());
            }
            int       index = numberGenerator(0, kanji.getLength());
            KanjiWord word  = kanji.getWord(index);

            japaneseText.Text = word.getKanji();
            furiganaText.Text = word.getFurigana();
            englishText.Text  = word.getEnglish();
            currentEnglish    = englishText.Text;
            currentRomaji     = word.getRomaji();
        }
Example #3
0
 void InstantiateItemInMap()
 {
     foreach (PositionBean posObject in itemWordMiner)
     {
         if (posObject.Type == "word")
         {
             GameObject newWordItem = Instantiate(wordItem) as GameObject;
             newWordItem.transform.position = new Vector3(posObject.XPos, posObject.YPos, 0f);
             kanjiWordScript                 = newWordItem.GetComponent <KanjiWord>();
             kanjiWordScript.isMoveable      = bool.Parse(posObject.Option["moving"]);
             kanjiWordScript.SpeedMultiplier = float.Parse(posObject.Option["speed"]);
             kanjiWordScript.Direction       = float.Parse(posObject.Option["direction"]);
             kanjiWordScript.TimeDelay       = float.Parse(posObject.Option["delay"]);
             kanjiWordScript.InvokeTime      = float.Parse(posObject.Option["timeinvoke"]);
         }
         else if (posObject.Type == "tnt")
         {
             GameObject tnt = Instantiate(explosion) as GameObject;
             tnt.transform.position = new Vector3(posObject.XPos, posObject.YPos, 0f);
         }
     }
 }
Example #4
0
    void FixedUpdate()
    {
//		if(grabberRigid2d.velocity != Vector2.zero){
        flameTransform.rotation = Quaternion.LookRotation(-grabberRigid2d.velocity);
//		}

        foreach (GameObject go in kanjiManagerScript.wordList2)
        {
            if (go != null)
            {
                KanjiWord kanjiWordScript = go.GetComponent <KanjiWord>();
                if (kanjiWordScript.grabbed)
                {
                    kanjiManagerScript.isKanjiGrabbed = true;
                }
            }
        }

        if (shoot)
        {
            if (!fairyFlyScript.didFairyArrive)
            {
                return;
            }
            if (!isChangedVelocity)
            {
//				Debug.Log("VECTOR HUONG "  + direction);
                grabberRigid2d.AddForce(direction * 1000f);
                isChangedVelocity = true;
//				Debug.Log("VECTOR VELOCITY : " + grabberRigid2d.velocity);
            }

            if (!isShooting)
            {
                Debug.Log("DAP DAU VAO TUONG NEN PHAI QUAY DAU");
                isShooting = true;
                grabberRigid2d.velocity = -grabberRigid2d.velocity;
            }
//
        }

        if (isMissed)
        {
            if (isPulling)
            {
                isMissed = false;
                FaceTheOtherWay();
                Debug.Log("MA SO 00000000000000001");
                return;
            }
            if (!d)
            {
                d = true;
                FaceTheOtherWay();
                Debug.Log("MA SO 00000000000000002");
//				Debug.Log("CHAY VAO MAY LAN VAY");
            }
//			Debug.Log("CO VAO DAY KHONG THE");
            if (CheckXMargin() && CheckYMargin())
            {
                ResetRotating();
                isMissed = false;
//				Debug.Log("CO VAO DAY KHONG THE");
            }


            return;
        }

        if (isPulling)
        {
            if (!b)
            {
                FaceTheOtherWay();
                Debug.Log("MA SO 00000000000000003");
                grabberRigid2d.velocity *= 0.1f;
                b = true;
            }


            if (CheckXMargin() && CheckYMargin())
            {
                foreach (GameObject go in kanjiManagerScript.wordList2)
                {
                    if (go != null)
                    {
                        KanjiWord kanjiWordScript = go.GetComponent <KanjiWord>();
                        if (kanjiWordScript.grabbed)
                        {
                            go.GetComponent <Renderer>().enabled = false;

                            Destroy(go);
                        }
                    }
                }
                ResetRotating();
            }
        }
    }